EditorUtility.ResetToPrefabState 重设到预置状态

static function ResetToPrefabState (obj : Object) : bool


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.

所有覆盖将被清除。然而,预设实例根游戏物体的transform.position 和 rotation,将不会被清除。

// Try to set the selected GameObject to a prefab state
class EditorUtilityResetToPrefabState extends ScriptableObject {

	@MenuItem("Examples/Attempt to reset to prefab %r")
	static function Reset() {
			Debug.Log("Reseted to prefab state successfully!");
			Debug.LogError("Couldnt reset to a prefab state " + Selection.activeGameObject.name);
	@MenuItem("Examples/Attemp to reset to prefab %r", true)
	static function CheckReset() {
		return Selection.activeGameObject != null;
Page last updated: 2011-7-16