Version: 2018.3b (switch to 2018.2 or 2017.4)
  • C#
Method group is Obsolete


Suggest a change


Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.


Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.



Obsolete public static bool ResetToPrefabState(Object obj);


Resets the properties of the component or game object to the parent Prefab state.

All overrides will be cleared. However the transform.position and rotation of a root game object in a Prefab instance will never be cleared.

using UnityEngine;
using UnityEditor;

class Example : EditorWindow { // Try to set the selected GameObject to a Prefab state

[MenuItem("Examples/Attempt to reset to Prefab %r")] static void Reset() { if (PrefabUtility.ResetToPrefabState(Selection.activeGameObject)) { Debug.Log("Reseted to Prefab state successfully!"); } else { Debug.LogError("Couldnt reset to a Prefab state " +; } }

[MenuItem("Examples/Attemp to reset to Prefab %r", true)] static bool CheckReset() { return Selection.activeGameObject != null; } }

Did you find this page useful? Please give it a rating: