feat: add mesh component editors and scene hierarchy serialization

This commit is contained in:
2026-03-31 21:25:59 +08:00
parent b92f9bfa70
commit be15bc2fc4
7 changed files with 341 additions and 7 deletions

View File

@@ -30,7 +30,6 @@ GameObject::GameObject(const std::string& name)
}
GameObject::~GameObject() {
GetGlobalRegistry().erase(m_id);
if (m_transform) {
delete m_transform;
m_transform = nullptr;
@@ -39,8 +38,10 @@ GameObject::~GameObject() {
}
std::unordered_map<GameObject::ID, GameObject*>& GameObject::GetGlobalRegistry() {
static std::unordered_map<ID, GameObject*> registry;
return registry;
// Keep the registry alive until process teardown to avoid static destruction
// order issues when GameObject instances are released from other singletons.
static auto* registry = new std::unordered_map<ID, GameObject*>();
return *registry;
}
void GameObject::NotifyComponentsBecameActive() {