ReSharper 2025.3 Help

Code inspection: Redundant attribute usage (redundant 'InitializeOnLoad' attribute)

If a class is marked with the [InitializeOnLoad] attribute, then Unity will ensure that the static constructor is called as the Unity editor starts, or when the run button is pressed.

This inspection will mark the [InitializeOnLoad] attribute usage as redundant if the class doesn't contain a static constructor. It will also add two quick fixes, one to remove the redundant attribute and another to create the static constructor in the class.

For more details, see the Unity documentation for InitializeOnLoadAttribute and Running Editor Script Code on Launch.

24 March 2026