Defaults main camera if the mainCamera is still unset

This commit is contained in:
maverickdgg 2022-10-21 10:17:32 +08:00
parent 267ad5f8c6
commit 7e04bee8d6
1 changed files with 6 additions and 1 deletions

View File

@ -30,9 +30,14 @@ namespace SHADE
void SHCameraDirector::UpdateMatrix() noexcept
{
if (mainCameraEID == MAX_EID)
{
auto& dense = SHComponentManager::GetDense<SHCameraComponent>();
if (dense.size() == 0)
{
return;
}
mainCameraEID = dense[0].GetEID();
}
SHCameraComponent* camComponent = SHComponentManager::GetComponent_s<SHCameraComponent>(mainCameraEID);
if (!camComponent)
{