Set entity world early
This commit is contained in:
parent
0b9b7bc1a8
commit
5f2c572f9a
@ -154,6 +154,7 @@ bool cEntity::Initialize(OwnedEntity a_Self, cWorld & a_EntityWorld)
|
|||||||
|
|
||||||
ASSERT(m_World == nullptr);
|
ASSERT(m_World == nullptr);
|
||||||
ASSERT(GetParentChunk() == nullptr);
|
ASSERT(GetParentChunk() == nullptr);
|
||||||
|
SetWorld(&a_EntityWorld);
|
||||||
a_EntityWorld.AddEntity(std::move(a_Self));
|
a_EntityWorld.AddEntity(std::move(a_Self));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1024,7 +1024,6 @@ void cWorld::Tick(std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_La
|
|||||||
}
|
}
|
||||||
for (auto & Entity : EntitiesToAdd)
|
for (auto & Entity : EntitiesToAdd)
|
||||||
{
|
{
|
||||||
Entity->SetWorld(this);
|
|
||||||
auto EntityPtr = Entity.get();
|
auto EntityPtr = Entity.get();
|
||||||
m_ChunkMap->AddEntity(std::move(Entity));
|
m_ChunkMap->AddEntity(std::move(Entity));
|
||||||
EntityPtr->OnAddToWorld(*this);
|
EntityPtr->OnAddToWorld(*this);
|
||||||
|
Loading…
Reference in New Issue
Block a user