ReSharper 2025.3 Help

Code inspection: Incorrect method signature

This inspection ensures that Unity event functions (like Start, Update, etc.) and methods marked with specific Unity attributes (such as [InitializeOnLoadMethod] or [RuntimeInitializeOnLoadMethod]) exactly match the required signatures expected by Unity APIs.

How it works

Unity relies on specific method signatures (modifiers, return types, and parameters) to correctly invoke event functions and callback methods. If a method's signature does not match what Unity expects, it might not be called at all, or it might cause runtime errors.

The analyzer checks method declarations against expected signatures. Depending on the mismatch, it flags issues such as:

  • Invalid static modifier.

  • Incorrect return type (e.g., method should return void).

  • Mismatched parameters (count or types).

  • Invalid type parameters.

For attributed methods, signatures are gathered from Unity's RequiredSignature metadata or a built-in list for known attributes.

Example

In this example, the Start method is incorrectly declared as static and returns an int with an extra parameter. The quick-fix automatically adjusts the signature to match Unity's requirements.

public class MyScript : MonoBehaviour { // Reported: Start should be non-static void with no parameters public static int Start(int value) { return 42; } }
public class MyScript : MonoBehaviour { // After fix: Signature corrected to match Unity's expectation public void Start() { return 42; } }

Multiple valid signatures

In some cases, Unity allows several different valid signatures for the same event function (for example, OnCollisionStay can be used with or without a Collision parameter). If the current signature matches none of the valid options, the inspection will prompt you to choose one of the available correct signatures.

26 March 2026