okay fuck it dont unload the shit cuz this error spam is annoying

This commit is contained in:
JohnCorby 2022-07-09 18:55:00 -07:00
parent 66b26a7263
commit 0944f18930

View File

@ -67,41 +67,20 @@ namespace NewHorizons.Handlers
_objectCache[obj] = assetBundles; _objectCache[obj] = assetBundles;
} }
if (sector)
{
// load it if ur already in the sector
if (sector.ContainsOccupant(DynamicOccupant.Player))
{
foreach (var assetBundle in assetBundles) foreach (var assetBundle in assetBundles)
{ {
StreamingManager.LoadStreamingAssets(assetBundle); StreamingManager.LoadStreamingAssets(assetBundle);
} }
}
sector.OnOccupantEnterSector += sectorDetector => if (sector)
{
sector.OnOccupantEnterSector += _ =>
{ {
if (sectorDetector.GetOccupantType() != DynamicOccupant.Player) return;
foreach (var assetBundle in assetBundles) foreach (var assetBundle in assetBundles)
{ {
StreamingManager.LoadStreamingAssets(assetBundle); StreamingManager.LoadStreamingAssets(assetBundle);
} }
}; };
sector.OnOccupantExitSector += sectorDetector =>
{
if (sectorDetector.GetOccupantType() != DynamicOccupant.Player) return;
foreach (var assetBundle in assetBundles)
{
StreamingManager.UnloadStreamingAssets(assetBundle);
}
};
}
else
{
// just load it immediately and hope for the best
foreach (var assetBundle in assetBundles)
{
StreamingManager.LoadStreamingAssets(assetBundle);
}
} }
} }
} }