USP0012 Don't flag private methods decorated with InitializeOnLoadMethodAttribute, RuntimeInitializeOnLoadMethodAttribute or DidReloadScripts as unused
Methods decorated with InitializeOnLoadMethodAttribute or RuntimeInitializeOnLoadMethodAttribute attributes are not unused.
IDE0051 - Remove unused private members
using UnityEngine;
using UnityEditor;
class Loader
{
[InitializeOnLoadMethod]
private static void OnProjectLoadedInEditor()
{
}
[RuntimeInitializeOnLoadMethod]
private static void OnSceneLoadedAndGameRunning()
{
}
}The IDE cannot find any references to the methods OnProjectLoadedInEditor and OnSceneLoadedAndGameRunning, and believes them to be unused.
Even though the IDE cannot find any references to OnProjectLoadedInEditor and OnSceneLoadedAndGameRunning, they will be called by Unity, and should not be removed.