ソースを参照

Fixed generic prefab loading

BearishSun 9 年 前
コミット
4c5c890f60

+ 3 - 3
Source/MBansheeEditor/General/EditorApplication.cs

@@ -541,13 +541,13 @@ namespace BansheeEditor
             {
                 SceneObject child = Scene.Root.GetChild(i);
 
+                if (EditorUtility.IsInternal(child))
+                    continue;
+
                 string prefabUUID = PrefabUtility.GetPrefabUUID(child);
                 if (prefabUUID == Scene.ActiveSceneUUID)
                     root = child;
 
-                if (EditorUtility.IsInternal(child))
-                    continue;
-
                 // If user added any other prefabs other than the initial one, the scene no longer represents a generic
                 // prefab (as we can now longer save it by applying changes only to that prefab)
                 numNormalChildren++;

+ 1 - 1
Source/MBansheeEditor/Utility/EditorUtility.cs

@@ -81,7 +81,7 @@ namespace BansheeEditor
         }
 
         /// <summary>
-        /// Checks is the provided scene object internal (hidden from normal user, used in internal engine systems).
+        /// Checks is the provided scene object internal (hidden from normal user, used by internal engine systems).
         /// </summary>
         /// <param name="so">Scene object to check.</param>
         /// <returns>True if internal, false otherwise. </returns>

+ 6 - 2
Source/SBansheeEngine/Source/BsScriptScene.cpp

@@ -57,13 +57,17 @@ namespace BansheeEngine
 		HPrefab prefab = GameResourceManager::instance().load<Prefab>(nativePath, true);
 		if (prefab.isLoaded(false))
 		{
-			HSceneObject root = prefab->instantiate();
-
 			// If scene replace current root node, otherwise just append to the current root node
 			if (prefab->isScene())
+			{
+				HSceneObject root = prefab->instantiate();
 				gSceneManager()._setRootNode(root);
+			}
 			else
+			{
 				gSceneManager().clearScene();
+				prefab->instantiate();
+			}
 
 			ScriptPrefab* scriptPrefab;
 			ScriptResourceManager::instance().getScriptResource(prefab, &scriptPrefab, true);