Exemplo n.º 1
0
        public static void CreateEasyMobilePrefabInstance(MenuCommand menuCommand)
        {
            GameObject prefab = EM_EditorUtil.GetMainPrefab();

            if (prefab == null)
            {
                prefab = EM_BuiltinObjectCreator.CreateEasyMobilePrefab();
            }

            // Stop if another instance already exists as a root object in this scene
            GameObject existingInstance = EM_EditorUtil.FindPrefabInstanceInScene(prefab, EditorSceneManager.GetActiveScene());

            if (existingInstance != null)
            {
                Selection.activeObject = existingInstance;
                return;
            }

            // Instantiate an EasyMobile prefab at scene root (parentless) because it's a singleton
            GameObject go = PrefabUtility.InstantiatePrefab(prefab) as GameObject;

            AddGameObjectToScene(go);
        }