Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 881 Bytes

File metadata and controls

34 lines (24 loc) · 881 Bytes

USP0019 Don't flag private members decorated with implicit-usage attributes as unused

Members decorated with PreserveAttribute, UsedImplicitlyAttribute or CreatePropertyAttribute attributes are not unused.

Suppressed Diagnostic ID

IDE0051 - Remove unused private members

Examples of code that produces a suppressed diagnostic

using UnityEngine;
using UnityEgine.Scripting;

class Loader
{
    [PreserveAttribute]
    private void InvokeMe()
    {
    }

    public string Name; // "InvokeMe" serialized
    private void Update() {
        Invoke(Name, 0);
    }
}

Why is the diagnostic reported?

The IDE cannot find any references to the method InvokeMe and believes it to be unused.

Why do we suppress this diagnostic?

Even though the IDE cannot find any references to InvokeMe , it will be called by Unity, and should not be removed.