Add FindActor with type and name to level.

This commit is contained in:
Chandler Cox
2023-06-02 15:29:28 -05:00
parent efed1f5b1d
commit fcbe624f7c
3 changed files with 40 additions and 0 deletions

View File

@@ -1481,6 +1481,16 @@ Actor* Level::FindActor(const MClass* type)
return result;
}
Actor* Level::FindActor(const MClass* type, const StringView& name)
{
CHECK_RETURN(type, nullptr);
Actor* result = nullptr;
ScopeLock lock(ScenesLock);
for (int32 i = 0; result == nullptr && i < Scenes.Count(); i++)
result = Scenes[i]->FindActor(type, name);
return result;
}
Script* Level::FindScript(const MClass* type)
{
CHECK_RETURN(type, nullptr);