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;
        }
Exemplo n.º 2
0
 public static SceneVariables Instance(Scene scene)
 {
     return(SceneSingleton <SceneVariables> .InstanceIn(scene));
 }