feat: add mesh component editors and scene hierarchy serialization
This commit is contained in:
@@ -108,6 +108,10 @@ Scene::Scene(const std::string& name)
|
||||
}
|
||||
|
||||
Scene::~Scene() {
|
||||
auto& registry = GameObject::GetGlobalRegistry();
|
||||
for (const auto& entry : m_gameObjects) {
|
||||
registry.erase(entry.first);
|
||||
}
|
||||
m_gameObjects.clear();
|
||||
}
|
||||
|
||||
@@ -156,6 +160,7 @@ void Scene::DestroyGameObject(GameObject* gameObject) {
|
||||
gameObject->OnDestroy();
|
||||
|
||||
m_gameObjectIDs.erase(gameObject->m_id);
|
||||
GameObject::GetGlobalRegistry().erase(gameObject->m_id);
|
||||
m_gameObjects.erase(gameObject->m_id);
|
||||
}
|
||||
|
||||
@@ -244,6 +249,10 @@ void Scene::LateUpdate(float deltaTime) {
|
||||
}
|
||||
|
||||
void Scene::DeserializeFromString(const std::string& data) {
|
||||
auto& registry = GameObject::GetGlobalRegistry();
|
||||
for (const auto& entry : m_gameObjects) {
|
||||
registry.erase(entry.first);
|
||||
}
|
||||
m_gameObjects.clear();
|
||||
m_rootGameObjects.clear();
|
||||
m_gameObjectIDs.clear();
|
||||
|
||||
Reference in New Issue
Block a user