Quellcode durchsuchen

Prefab resources will now properly cleanup the scene objects they own

BearishSun vor 10 Jahren
Ursprung
Commit
6455f47bc7
2 geänderte Dateien mit 7 neuen und 0 gelöschten Zeilen
  1. 1 0
      BansheeCore/Include/BsPrefab.h
  2. 6 0
      BansheeCore/Source/BsPrefab.cpp

+ 1 - 0
BansheeCore/Include/BsPrefab.h

@@ -15,6 +15,7 @@ namespace BansheeEngine
 	{
 	{
 	public:
 	public:
 		Prefab();
 		Prefab();
+		~Prefab();
 
 
 		/**
 		/**
 		 * @brief	Creates a new prefab from the provided scene object. If the scene object
 		 * @brief	Creates a new prefab from the provided scene object. If the scene object

+ 6 - 0
BansheeCore/Source/BsPrefab.cpp

@@ -12,6 +12,12 @@ namespace BansheeEngine
 		
 		
 	}
 	}
 
 
+	Prefab::~Prefab()
+	{
+		if (mRoot != nullptr)
+			mRoot->destroy(true);
+	}
+
 	HPrefab Prefab::create(const HSceneObject& sceneObject)
 	HPrefab Prefab::create(const HSceneObject& sceneObject)
 	{
 	{
 		PrefabPtr newPrefab = createEmpty();
 		PrefabPtr newPrefab = createEmpty();