Respawn item again once it is destroyed.

So basically i would like it so that when an object gets destroyed, it respawns again in a set position.

I am making a ragdoll like game and sometimes the ragdoll gets destroyed and i would like it so that when this happens the level does not reload, instead the ragdoll is just spawned again.

Thanks in advance for any help.

This is only a suggestion as I’m not sure you can use an object once it has been destroyed.

But instead of destroying it, you could just set the position of it to wherever you want it to respawn. If you don’t want it to appear right away, you could hide it and deactivate its collider until you want it to appear again.

Something like:

OnTriggerEnter(other : Collider)
other.renderer.enabled = false;
other.collider.enabled = false;
other.transform.position = desiredPosition;

And have another trigger at the respawn point which enables the renderer and collider again. Use a coroutine if you want to delay any of the actions.

I’m sure there are hundreds of better answers though, this is just how I would do it! :slight_smile: