USP0014 The Unity runtime invokes Unity messages

June 12, 2020 ยท View on GitHub

Unity messages should not be flagged as candidates for static modifier.

Suppressed Diagnostic ID

CA1822 - Mark members as static

Examples of code that produces a suppressed diagnostic

using UnityEngine;

class Camera : MonoBehaviour
{
	void Update()
	{
		//Some code that does not access instance data
	}
}

Why is the diagnostic reported?

Members that do not access instance data or call instance methods can be marked as static for performance reasons.

Why do we suppress this diagnostic?

Unity messages will not be processed if they are marked static.