Reseting Component/GameObject to its initial scene state.

I would like to create a basic behaviour for my components that lets them be reset to the original values at the begining of the scene when they are complete. In otherwords, I want a simple way to create 'Repeat on Complete' functionality. Without reloading the scene or instantiating a prefab, is there a way to reset an object/component to its original scene state?

Create an object prefab with desired properties. In-game instantiate this prefab. Change those properties however you like. When you need to set defaults, simply destroy this game object and instantiate a new one from the prefab. Now, this new one will have all props set to default. If you want to change some of those, simply adjust them just before instantiation.

I don't think there's a built-in way, but you could implement this yourself by storing the values that you'd like to be re-set in the Start function. Eg:

var originalPosition : Vector3;
var originalRotation : Quaternion;

function Start() {
    originalPosition = transform.position;
    originalRotation = transform.rotation;

function Reset() {
    transform.position = originalPosition;
    transform.rotation = originalRotation;
    if (rigidbody != null) {
        rigidbody.velocity =;
        rigidbody.angularVelocity =;

If you wanted to re-set other values such as animation state, visibility, etc, you'd have to add each of these as separate variables, with the corresponding lines of code to reset them.

Make your object an prefab and try


It not seems to work for me though, but the docs says “Resets the properties of the component or game object to the parent prefab state”

//read all game objects and set initial position when ever it needs

in c#

private Dictionary<GameObject,Vector3> current_obj_trans_value = new Dictionary<GameObject,Vector3>();

public void intial_pos_set()

   object[] allObjects = FindObjectsOfTypeAll(typeof(GameObject)) ;

   foreach(object thisObject in allObjects)
    if (((GameObject) thisObject).activeInHierarchy &&((GameObject) 

        thisObject).GetComponent() != null)


public void reset_tranform_pos()

    foreach(KeyValuePair<GameObject,Vector3> allactobj in 

	    allactobj.Key.transform.position= allactobj.Value;