Exiting an if statement when calling a function from another script (Possible bug)

Hi, in my code I have an If statement that’s conditional is based on the currentBaseState of my mecanim controller and currently the statement returns when it reaches a call to a separate script?

if (currentBaseState.fullPathHash == hashes.attackState)
            impacted = true;
            runAttacked = false;

The Target is a transform for the enemy and it calls the enemy script to take damage. The impacted and runAttacked are just bools and the Debug.Log(“Boom”) is just to register the conditional in my console.

Is this a bug or am I not understanding how an if statement works with calling another function from a separate script?

Please help!

Well, if the booleans are set and the Debug.Log shows up when the line is commented out, but aren’t executed when it’s not that means that line throws an exception. However as Yash said in the comment above you wouldn’t notice this exception if you catch it manually with try catch or if it’s executed inside a coroutine. If you don’t you should see the exception in the console.

All that information is missing in your question. So you should provide more context. Where is that snippet of code located.