feat: add mesh component editors and scene hierarchy serialization
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user