Explorar o código

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

BearishSun %!s(int64=9) %!d(string=hai) anos
pai
achega
1da37a01e4
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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);