Code inspection: Method referenced in string literal does not have the expected signature
This inspection reports string-based Unity method references that resolve to a method with the wrong signature.
This typically happens in APIs such as Invoke, InvokeRepeating, StartCoroutine, CancelInvoke, and similar Unity APIs that take a method name as a string. The method exists, but its parameters, return type, or static/instance usage do not match what Unity expects.
Example
In this example, InvokeRepeating expects a parameterless instance method, but LaunchProjectile is declared with an int parameter.
using UnityEngine;
public class Example : MonoBehaviour
{
void Start()
{
InvokeRepeating("LaunchProjectile", 1f, 1f);
}
// Reported: InvokeRepeating expects a parameterless instance method.
private void LaunchProjectile(int count)
{
}
}
using UnityEngine;
public class Example : MonoBehaviour
{
void Start()
{
InvokeRepeating("LaunchProjectile", 1f, 1f);
}
private void LaunchProjectile()
{
}
}
Quick-fix
This inspection does not provide a dedicated quick-fix on the string literal itself. The code must be corrected by changing the referenced method signature to the one Unity expects.
26 March 2026