le warning

This commit is contained in:
JohnCorby 2022-08-05 13:58:02 -07:00
parent cb99996451
commit 754e17968a

View File

@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Handlers namespace NewHorizons.Handlers
{ {
@ -72,8 +73,13 @@ namespace NewHorizons.Handlers
StreamingManager.LoadStreamingAssets(assetBundle); StreamingManager.LoadStreamingAssets(assetBundle);
} }
if (sector) if (!sector)
{ {
Logger.LogWarning($"StreamingHandler for {obj} has null sector." +
$"This can lead to the thing being unloaded permanently.");
return;
}
sector.OnOccupantEnterSector += _ => sector.OnOccupantEnterSector += _ =>
{ {
foreach (var assetBundle in assetBundles) foreach (var assetBundle in assetBundles)
@ -84,4 +90,3 @@ namespace NewHorizons.Handlers
} }
} }
} }
}