From 7e04bee8d6a7ef341430a054017177f64d9788c1 Mon Sep 17 00:00:00 2001 From: maverickdgg Date: Fri, 21 Oct 2022 10:17:32 +0800 Subject: [PATCH] Defaults main camera if the mainCamera is still unset --- SHADE_Engine/src/Camera/SHCameraDirector.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SHADE_Engine/src/Camera/SHCameraDirector.cpp b/SHADE_Engine/src/Camera/SHCameraDirector.cpp index 5e49fdfe..559897c0 100644 --- a/SHADE_Engine/src/Camera/SHCameraDirector.cpp +++ b/SHADE_Engine/src/Camera/SHCameraDirector.cpp @@ -31,7 +31,12 @@ namespace SHADE { if (mainCameraEID == MAX_EID) { - return; + auto& dense = SHComponentManager::GetDense(); + if (dense.size() == 0) + { + return; + } + mainCameraEID = dense[0].GetEID(); } SHCameraComponent* camComponent = SHComponentManager::GetComponent_s(mainCameraEID); if (!camComponent)