Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easy integration with Unity? #32

Open
NeistH2o opened this issue Jul 5, 2024 · 2 comments
Open

Easy integration with Unity? #32

NeistH2o opened this issue Jul 5, 2024 · 2 comments

Comments

@NeistH2o
Copy link

NeistH2o commented Jul 5, 2024

Hi there,

I wanted to use the MustDisposeResourceAttribute in my unity project. I couldn't find a way to import this package in the project, so I copied over the relevant files from here to my project. [MustDisposeResource] does work now, but I had to comment parts of Annotations.cs like CanBeNullAttribute, because it led to ambiguous declarations with the already provided annotations in Unity.

Is there any plan to make these attributes available in Unity by default?

EDIT: Maybe there is a way to import nuget packages in unity projects from Rider, sorry if I missed something obvious.

@citizenmatt
Copy link
Member

Unfortunately, Unity has their own copy of the annotations and they're public, so become part of Unity's public API. Ideally, they would have added them as internal. Rider/ReSharper would still see the annotations, but they wouldn't become part of their API, and Unity projects could easily add their own copy for their own code.

Unity can keep their copy up to date if they wish, and we have worked with them in the past to update things, but that still requires updating Unity versions and so on.

The best thing to do now is to add a copy of the annotations to your Unity project, and then simply delete any conflicting type definitions. This might not be an elegant solution, but it is fairly straightforward and will work fine.

@citizenmatt
Copy link
Member

Oh, and you can use the Copy C# implementation to clipboard button on the Code Annotations settings page in Rider/ReSharper to get a copy of the annotations without having to download them from GitHub. Makes it a little easier.

Screenshot 2024-07-16 at 7 21 23 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants