Ejemplo n.º 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();
        }
Ejemplo n.º 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 ();
        }