Hi, I am a newbie in Unity. So, I have use this simple script to make AI track an object.
move = true;
// find reference for the ball transform
GameObject ballGameObject = GameObject.Find("ball");
if (ballGameObject == null)
{
Debug.LogWarning("PlayerAI cannot find ball.");
enabled = false;
}
else
{
ballTransform = ballGameObject.transform;
}
The problem is when I use instantiate, the AI will not track to the instantiated object. I have also change the tag, but still it will return the log warning. So the question is, what do I need to do to make the AI works to instantiated object?