Respawning objects

I am looking to respawn objects/cubes as they hit a collider, I have been trying to update a script to add an IF statement in the Ontrigger function using CS, just looking for a few code examples or a point in the right direction. Thanks.

well if you want your cubs instantly respawn as they hit the collider maybe you should do something like this:

if (collision.transform.name == “Cube”)
{
Destroy(gameObject, 0);
clone = Instantiate(YourObject, RespawnPoint.transform.position, RespawnPoint.transform.rotation) as Rigidbody;
}

I would recommend not destroying them and just resetting them and moving them back to their original spawn position.
Its a good bit better for performance.