Challenge Bonus: printing the name

You don’t have to refer to the gameObject of the enemy, since the AIController is a MonoBehaviour you can just get the name:

        private void Update()
        {
            if (DistanceToPlayer() < chaseDistance)
            {
                Debug.Log($"{name} chasing the player");
            }
        }
1 Like

Privacy & Terms