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

@ -31,7 +31,12 @@ namespace SHADE
{
if (mainCameraEID == MAX_EID)
{
return;
auto& dense = SHComponentManager::GetDense<SHCameraComponent>();
if (dense.size() == 0)
{
return;
}
mainCameraEID = dense[0].GetEID();
}
SHCameraComponent* camComponent = SHComponentManager::GetComponent_s<SHCameraComponent>(mainCameraEID);
if (!camComponent)