Created
March 24, 2015 12:04
-
-
Save shahin-dev/2b9894e7a9474ac97770 to your computer and use it in GitHub Desktop.
revert to prefab
This file contains hidden or 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
Well after more unsuccessful searching I read up on the Editor scripting reference and managed to write a script that resets all selected GameObjects to their prefab settings. | |
@MenuItem ("Tools/Revert to Prefab %r") | |
static function Revert() { | |
var selection = Selection.gameObjects; | |
if (selection.length > 0) { | |
for (var i : int = 0; i < selection.length; i++) { | |
EditorUtility.ResetGameObjectToPrefabState(selection[i]); | |
} | |
} else { | |
Debug.Log("Cannot revert to prefab - nothing selected"); | |
} | |
} | |
As I said I'm new to scripting the editor and it may not be the best way to do this but it works for me and that's all I need right now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment