瀏覽代碼

Fixing a crash when reverting a prefab (new instance would be registered twice as a child)

BearishSun 9 年之前
父節點
當前提交
1da37a01e4
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      Source/BansheeCore/Source/BsPrefabUtility.cpp

+ 3 - 0
Source/BansheeCore/Source/BsPrefabUtility.cpp

@@ -28,6 +28,9 @@ namespace BansheeEngine
 		so->destroyInternal(currentSO, true);
 
 		HSceneObject newInstance = prefabLink->instantiate();
+
+		// Remove default parent, and replace with original one
+		newInstance->mParent->removeChild(newInstance);
 		newInstance->mParent = parent;
 
 		restoreLinkedInstanceData(newInstance, soProxy, linkedInstanceData);