USP0005 The Unity runtime invokes Unity messages

February 28, 2020 ยท View on GitHub

Unused parameters should not be removed from Unity messages.

Suppressed Diagnostic ID

IDE0060 - Remove unused parameters

Examples of code that produces a suppressed diagnostic

using UnityEngine;

class Camera : MonoBehaviour
{
	void OnCollisionEnter(Collision c)
	{
		// do stuff, but c remains unused
	}
}

Why is the diagnostic reported?

The IDE does not detect that you've used c, and under normal circumstances, it would be reasonable to remove the unused parameter.

Why do we suppress this diagnostic?

The IDE doesn't realize this is a Unity message, and therefore has no way of determining that it needs to have a specific signature to function correctly.