diff --git a/assets/Mods/shared/UEHelpers/UEHelpers.lua b/assets/Mods/shared/UEHelpers/UEHelpers.lua index 359c7d64b..c7f408b95 100644 --- a/assets/Mods/shared/UEHelpers/UEHelpers.lua +++ b/assets/Mods/shared/UEHelpers/UEHelpers.lua @@ -102,13 +102,13 @@ local WorldCache = CreateInvalidObject() ---@cast WorldCache UWorld function UEHelpers.GetWorld() if WorldCache:IsValid() then return WorldCache end - local GameInstance = UEHelpers.GetGameInstance() - if GameInstance:IsValid() then - WorldCache = GameInstance:GetWorld() - else -- Worst case fallback, usaully should never happen - local PlayerController = UEHelpers.GetPlayerController() - if PlayerController:IsValid() then - WorldCache = PlayerController:GetWorld() + local PlayerController = UEHelpers.GetPlayerController() + if PlayerController:IsValid() then + WorldCache = PlayerController:GetWorld() + else + local GameInstance = UEHelpers.GetGameInstance() + if GameInstance:IsValid() then + WorldCache = GameInstance:GetWorld() end end return WorldCache