private static void MenuCommand(MenuCommand menuCommand) { var scene = SceneManager.GetActiveScene(); if (SceneSingleton <SceneVariables> .InstantiatedIn(scene)) { EditorUtility.DisplayDialog("Scene Variables", "The scene already contains a variables object.", "OK"); return; } var go = SceneSingleton <SceneVariables> .InstanceIn(scene).gameObject; GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); Undo.RegisterCreatedObjectUndo(go, "Create Scene Variables"); Selection.activeObject = go; }
public static bool InstantiatedIn(Scene scene) { return(SceneSingleton <SceneVariables> .InstantiatedIn(scene)); }