Method Not Calling

This is the code where i got problem the first debug message is running correctly but gameManager.CorrectMove() and Debug.Log(gameManager.correctedPipes) not working there is a counter in the CorrectMove() which increases

GameManager gameManager;

void Start
{
     gameManager = GetComponent<GameManager>();
}
if (difference <= rotationTolerance)
{
    Debug.Log("Matched");
    gameManager.CorrectMove(); // Call GameManager's CorrectMove method
    Debug.Log(gameManager.correctedPipes);
    return;
}
public void CorrectMove()
{
     correctedPipes += 1;
}

Are you sure that your “GameManager” component is attached to the same gameobject as this script? Because GetComponent can only find components on the gameobject you call it on. When none is specified, you call it on “this” this.GetComponent.

Though when the component is not found, you should get a NullReference exception or a MissingReference exception in your console. Of course an exception will immediately terminate the execution of your code since this is an exceptional state which can not be resolved. Unity catches all exceptions that occur in any of the callbacks it provides and prints it in the console.