Instantiating GameObjects after a certain amount has been reached?

I want to be able to instantiate a prefab (which I know how to do), only after the first one has fulfilled a set criteria. Example: spawning new tetromino after the previous one has touched the bottom of the board. Is there any particular way of doing this?

Hey i saw you’re post

What do you mean with the bottom of the board ?
What you could do if i think what you mean with it.
You can make a collider on the bottom of the board and when the collider is triggered.
You instantiate a new object :slight_smile:
I am developing my program skills with helping people.
Correct me if i make some mistakes.

Hum, this is an interesting case of project architecture.

One may prefer to have a “controller” that controls the object, and therefore knows when it reaches the ground, and can trigger the instantiation.

You may also use events, it’s pretty handy when you don’t know when something is going to happen, and especially which object is going to raise the event.

In your case, I understand only one object (the spawner) must be notified of the event, so you may just have your Spawner “watch” the object position. Like

	private Transform current;
	public GameObject reference;
	public Transform limit;

	void Start ()
	{
		Spawn();
	}

	void Update ()
	{
		if (current.position.y <= limit.position.y)
		{
			Destroy(current.gameObject); // destroy current
			Spawn();
		}
	}

	void Spawn ()
	{
		current = ((GameObject) Instantiate (reference, transform.position, transform.rotation)).transform;
	}