Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity/ReSharper UsedImplicitly not working

I'm using ReSharper 8.1 for Visual Studio 2013, while writing code for Unity 4.6.0.

As expected, functions like Update, Start and Awake are labeled as "unused".

Now, ReSharper suggests adding an Annotations.cs file, and using the [UsedImplicitly] annotation to ignore the warning.

The problem is... this doesn't work, I have Annotations.cs in my project, and the following code still mentions that Start is unused:

    [UsedImplicitly]
    private void Start()
    {
        //doStuff
    }

The code compiles fine, but trying to ignore this from the context menu suggests to add another Annotations.cs file (in this case, named Annotations1.cs, because Annotations.cs already exists).

like image 556
sirius black Avatar asked Jul 24 '26 06:07

sirius black


1 Answers

Have you changed the namespace in the annotations file? If so, you need to tell ReSharper to look in the new namespace. Presumably, it's not finding the annotation attribute, which is why it's prompting to add another annotations.cs file.

like image 187
citizenmatt Avatar answered Jul 25 '26 19:07

citizenmatt