-
-
Save kxn4t/dc274616b57bfe484aa1a93bed838975 to your computer and use it in GitHub Desktop.
GameObjectのアクティブ状態とEditorOnlyを切り替えるショートカット(Ctrl + g)
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
using UnityEditor; | |
namespace kxn4t.gist | |
{ | |
internal class ToggleObjectsActive | |
{ | |
[MenuItem("Tools/kxn4t gists/Toggle objects active %g")] | |
private static void ToggleObjectsBetweenActiveAndEditorOnly() | |
{ | |
foreach (var item in Selection.transforms) | |
{ | |
Undo.RecordObject (item.gameObject, "Toggle objects active"); | |
item.gameObject.tag = item.gameObject.activeSelf ? "EditorOnly" : "Untagged"; | |
item.gameObject.SetActive(!item.gameObject.activeSelf); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment