mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-09 20:08:57 +03:00
Make sure prefabs gets unique entity IDs
This commit is contained in:
@@ -71,8 +71,13 @@ namespace Nuake {
|
||||
{
|
||||
for (json e : j["Entities"])
|
||||
{
|
||||
Entity entity = Entity { Engine::GetCurrentScene()->m_Registry.create(), Engine::GetCurrentScene().get() };
|
||||
Entity entity = Engine::GetCurrentScene()->CreateEntity("-");
|
||||
auto& nameComponent = entity.GetComponent<NameComponent>();
|
||||
|
||||
int entityId = nameComponent.ID;
|
||||
entity.Deserialize(e.dump());
|
||||
nameComponent.ID = entityId;
|
||||
|
||||
this->AddEntity(entity);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user