Unity is complaining that I’m using my _unitAnimator variable while it is not assigned. However, it clearly is assigned in the editor:
[SerializeField] private Animator _unitAnimator;
private void Update()
{
_unitAnimator.SetBool("IsWalking", IsWalking()); // Complains here
// Cut out irrelevant code
}
private bool IsWalking()
{
return transform.position != _targetPosition;
}
The unit animator was set in the editor while not in play mode.
I tried restarting Unity and renaming the variable and reassigning it in the editor.
Any ideas what might be happening here?