예제 #1
0
        private void ClickPrefabButton(ScenePrefab _prefab)
        {
            if (activeScenePrefab == scenePrefabs.IndexOf(_prefab))
            {
                // Clicked twice, add new
                string     fileName = assetFolder + _prefab.prefabPath + ".prefab";
                GameObject newOb    = (GameObject)PrefabUtility.InstantiatePrefab(AssetDatabase.LoadAssetAtPath(fileName, typeof(GameObject)));
                Undo.RegisterCreatedObjectUndo(newOb, "Created " + newOb.name);

                if (newOb.GetComponent <GameCamera2D>())
                {
                    newOb.GetComponent <GameCamera2D>().SetCorrectRotation();
                }

                PutInFolder(newOb, _prefab.sceneFolder);
                EditorGUIUtility.PingObject(newOb);
            }

            activeScenePrefab = scenePrefabs.IndexOf(_prefab);
            GetPrefabsInScene();
        }
예제 #2
0
        private void ClickPrefabButton(ScenePrefab _prefab)
        {
            if (activeScenePrefab == scenePrefabs.IndexOf (_prefab))
            {
                // Clicked twice, add new
                string fileName = assetFolder + _prefab.prefabPath + ".prefab";
                GameObject newOb = (GameObject) PrefabUtility.InstantiatePrefab (AssetDatabase.LoadAssetAtPath (fileName, typeof (GameObject)));
                Undo.RegisterCreatedObjectUndo (newOb, "Created " + newOb.name);

                if (newOb.GetComponent <GameCamera2D>())
                {
                    newOb.GetComponent <GameCamera2D>().SetCorrectRotation ();
                }

                PutInFolder (newOb, _prefab.sceneFolder);
                EditorGUIUtility.PingObject (newOb);
            }

            activeScenePrefab = scenePrefabs.IndexOf (_prefab);
            GetPrefabsInScene ();
        }