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