private void Update() { if (character == null) { return; } enemy.lookAtTarget.LookAt(character); float distanceToCharacter = Vector3.Distance(transform.position, character.transform.position); if (distanceToCharacter > limit) { enemy.SetNewState(states.FOLLOW); chatUI.Hide(); } }