Hi! I would like to have an object appear in my scene, and once the player collided with it (‘picked it up’), it would disappear and a new object would appear on the scene. Once the player picked this one up, again, a new one would appear, and so on up until 4 or 5 objects. (It’s a bit like a search game and you can look for only one item at the time.)
I manually put down 4 spheres, and put these lines in my player’s movement script:
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Sphere"))
{ other.gameObject.SetActive(false);
}
}
So what I could achieve with this was that when the game starts, all objects are visible and the player can pick them up one-by-one.
However, I don’t know how to make the objects appear one by one. I understand how to deactivate a single object at Start(), and activate it when an event occurs, I just don’t understand how to do it dynamically when it comes to 4 objects. Could you please give me some advice? Thank you in advance.