USP0019 Don't flag private methods decorated with PreserveAttribute or UsedImplicitlyAttribute as unused
Methods decorated with PreserveAttribute
or UsedImplicitlyAttribute
attributes are not unused.
IDE0051 - Remove unused private members
using UnityEngine;
using UnityEgine.Scripting;
class Loader
{
[PreserveAttribute]
private void InvokeMe()
{
}
public string Name; // "InvokeMe" serialized
private void Update() {
Invoke(Name, 0);
}
}
The IDE cannot find any references to the method InvokeMe
and believes it to be unused.
Even though the IDE cannot find any references to InvokeMe
, it will be called by Unity, and should not be removed.