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,16 +73,20 @@ namespace NewHorizons.Handlers
StreamingManager.LoadStreamingAssets(assetBundle); StreamingManager.LoadStreamingAssets(assetBundle);
} }
if (sector) if (!sector)
{ {
sector.OnOccupantEnterSector += _ => Logger.LogWarning($"StreamingHandler for {obj} has null sector." +
{ $"This can lead to the thing being unloaded permanently.");
foreach (var assetBundle in assetBundles) return;
{
StreamingManager.LoadStreamingAssets(assetBundle);
}
};
} }
sector.OnOccupantEnterSector += _ =>
{
foreach (var assetBundle in assetBundles)
{
StreamingManager.LoadStreamingAssets(assetBundle);
}
};
} }
} }
} }