-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from arimger/develop
Develop - 0.12.7
- Loading branch information
Showing
16 changed files
with
322 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using UnityEditor; | ||
|
||
namespace Toolbox.Editor.Utilities | ||
{ | ||
public static class PrefabUtility | ||
{ | ||
[MenuItem("GameObject/Prefab/Revert Prefab Name", true, -100)] | ||
public static bool ValidateRevertPrefabName() | ||
{ | ||
var gameObjects = Selection.gameObjects; | ||
for (int i = 0; i < gameObjects.Length; i++) | ||
{ | ||
var gameObject = gameObjects[i]; | ||
if (UnityEditor.PrefabUtility.IsAnyPrefabInstanceRoot(gameObject)) | ||
{ | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
[MenuItem("GameObject/Prefab/Revert Prefab Name", false, -100)] | ||
public static void RevertPrefabName() | ||
{ | ||
var gameObjects = Selection.gameObjects; | ||
Undo.RecordObjects(gameObjects, "Revert Prefab Name"); | ||
for (int i = 0; i < gameObjects.Length; i++) | ||
{ | ||
var gameObject = gameObjects[i]; | ||
var prefabObject = UnityEditor.PrefabUtility.GetCorrespondingObjectFromSource(gameObject); | ||
if (prefabObject == null) | ||
{ | ||
continue; | ||
} | ||
|
||
gameObject.name = prefabObject.name; | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Editor Toolbox/Editor/Utilities/PrefabUtility.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.