A Unity method is invoked by its name in a string, which the compiler cannot check

tx0/csharp:unity-method-by-namestrictwarningframeworks/unitydepth fastmaintainability

What it finds

Invoke("Spawn", 1f), InvokeRepeating, SendMessage and StartCoroutine("Name") find the method by a string at run time: a renamed method breaks silently, and the lookup is slow. A coroutine or a direct call names the method in code.

From the rule's source, unity_method_by_name.rs.

Example from the rule's tests
using UnityEngine; class Spawner : MonoBehaviour{    void Start()    {        Invoke("Spawn", 1f);tx0 reports: Invoke finds its method by a string        Spawn();    }     void Spawn() { }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:unity-method-by-name" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/csharp:unity-method-by-name] reason="..."

tx0 explain tx0/csharp:unity-method-by-name shows the same in the terminal. Found a false positive? Report it.