Does anyone know a script that will respawn an object to it’s original location after it is destroyed? Any information would greatly help, thanks!
–Velk
Does anyone know a script that will respawn an object to it’s original location after it is destroyed? Any information would greatly help, thanks!
–Velk
Keep in mind that if you actually destroy an object, it’s gone. You may want to have a method called WhenKilled or something that resets your object’s position without actually eliminating it.
However, taking your question literally, you could use OnDisable to create a copy of your object just before it’s destroyed.
var originalPosition : Vector3;
function Start() {
originalPosition = transform.position;
}
function OnDisable() {
Instantiate( gameObject, originalPosition, Quaternion.identity );
}