I’m geting a NullReferenceException that I can’t seem to nail down (screenshot below).
I’m thinking it’s really complaining about deltaTime as it’s a local float variable (which is never set) vs. Time.deltaTime but it’s how the instructor wrote it and he didn’t get an exception. I’m trying to figure out where I went wrong.
The code in IsInChaseRange() matches.
protected bool IsInChaseRange()
{
float playerDistanceSqr = (stateMachine.Player.transform.position - stateMachine.transform.position).sqrMagnitude;
return playerDistanceSqr <= stateMachine.PlayerChasingRange * stateMachine.PlayerChasingRange;
}
Where IsInChaseRange()) is called.
if (IsInChaseRange())
{
Debug.Log("In Range");
//Transition to chasing state
return;
}