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

Mark methods with MenuItem atribute as used #19

Closed
dantreble opened this issue Jan 8, 2016 · 7 comments
Closed

Mark methods with MenuItem atribute as used #19

dantreble opened this issue Jan 8, 2016 · 7 comments

Comments

@dantreble
Copy link

http://imgur.com/aEwEMAj

http://docs.unity3d.com/ScriptReference/MenuItem.html

Thanks!

citizenmatt added a commit that referenced this issue May 23, 2016
Also commented out a couple of NotNull annotations that go against API docs, if not observed behaviour

Fixes #15, #19, #23, #26, #31
@aybe
Copy link

aybe commented Jun 14, 2020

It's now four years later but this is still happening:

devenv_2020-06-14_15-44-39

Unity 2020.2.0a13.1691
Unity Support 2020.1.0.179
Resharper 2020.1.3
Visual Studio 16.6.2

Thank you

@citizenmatt
Copy link
Member

This isn't what I'm seeing. A private method is marked as unused, but it's Visual Studio doing that, and there's not much we can do to fix that. Your screenshot is showing that ReSharper thinks it's unused, but mine shows that ReSharper thinks it's in use - you can see the Roslyn icon in the Alt+Enter menu.

Screenshot 2020-06-14 at 5 14 51 pm

Can you confirm that the Unity Support plugin is working elsewhere? Do you see "Unity event functions" in the Generate method, for example?

Also, this wasn't with exactly the same version of Unity. Can you confirm that the attribute is still called MenuItem and not MenuItemAttribute? Ctrl+Click to navigate will confirm.

@aybe
Copy link

aybe commented Jun 14, 2020

I confirm that indeed it is the right attribute.

Also, the plugin does work as for instance, I can generate Unity event functions.

And the screen you've posted is intereseting to say the least, I've never seen that magnifier icon along those squiggles on light or wrench.

I don't know what's going on, maybe something's wrong on my side.

@citizenmatt
Copy link
Member

You get the magnifier if you use the alt+enter keyboard shortcut, while clicking the icon in the text gutter doesn't show it (the idea is that the magnifier icon is a hint that you can click + search, or just start typing to search. TBH, I don't get why it's not shown on click too).

The squiggles on the lightbulb and wrench are the Roslyn logo, and indicate that these actions come from Visual Studio, rather than ReSharper.

Can you show the Quick Doc for the MenuItem attribute? It should show the attributes that are applied to it, including the external attributes added by the plugin. You should see something like this, with [MeansImplicitUse] (the attributes might be collapsed as […] - click to expand).

Screenshot 2020-06-14 at 10 57 57 pm

@aybe
Copy link

aybe commented Jun 15, 2020

Okay it so obvious that I did manage to not see it during all this time, indeed the magnifier is present !

Now I think we're getting closer to the problem, MeansImplicitUse is nowhere to be seen for me:

devenv_2020-06-15_11-33-50

But the attribute exists ... and I use attributes from Unity assemblies. Actually I've even tried to copy custom annotations implementation but they are simply ignored as using UnityEditor will import Unity's ones and therefore hide custom annotations.

@citizenmatt
Copy link
Member

Hang on, that popup says that MenuItem is defined in UnityEditor.CoreModule.dll - that looks new! I guess they're splitting the UnityEditor assembly up into different modules now. That would explain why you're not seeing this - the external attribute is only defined for the UnityEditor.dll assembly.

I'll see if I can get some more details on this.

@aybe
Copy link

aybe commented Jun 15, 2020

Alright, great !

That's funny how each other can have different setups and get so much different results 🤣.

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

3 participants