Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 726 Bytes

USP0008.md

File metadata and controls

33 lines (23 loc) · 726 Bytes

USP0008 Don't flag private methods used with Invoke/InvokeRepeating or StartCoroutine/StopCoroutine as unused

Private methods used with Invoke, InvokeRepeating, StartCoroutine or StopCoroutine are not unused.

Suppressed Diagnostic ID

IDE0051 - Remove unused private members

Examples of code that produces a suppressed diagnostic

using UnityEngine;

class Camera : MonoBehaviour
{
	void Start()
	{
		Invoke("InvokeMe", 10.0f);
	}

	private void InvokeMe()
	{
		// Invoke me
	}
}

Why is the diagnostic reported?

The IDE cannot detect any calls to InvokeMe in the class.

Why do we suppress this diagnostic?

InvokeMe is called indirectly by Unity, which is undetectable by the IDE.