Revert "Refresh cache only one scene change"

This reverts commit 127f8f62c576aedd92765792392a3703671bf50b.
This commit is contained in:
Nick 2022-05-14 19:45:38 -04:00
parent 50d483b731
commit 0ba8502398

View File

@ -58,7 +58,6 @@ namespace NewHorizons
private string _defaultStarSystem = "SolarSystem"; private string _defaultStarSystem = "SolarSystem";
private string _currentStarSystem = "SolarSystem"; private string _currentStarSystem = "SolarSystem";
private bool _isChangingStarSystem = false; private bool _isChangingStarSystem = false;
private bool _refreshCacheOnLoad = false; // Will refresh when changing systems
private bool _firstLoad = true; private bool _firstLoad = true;
private ShipWarpController _shipWarpController; private ShipWarpController _shipWarpController;
@ -170,20 +169,10 @@ namespace NewHorizons
private void OnSceneUnloaded(Scene scene) private void OnSceneUnloaded(Scene scene)
{ {
// Always clear this one because the game objects will be null now
SearchUtilities.ClearCache(); SearchUtilities.ClearCache();
ImageUtilities.ClearCache();
// Clear caches if we've left the actual game scene or if we've specified to do it AudioUtilities.ClearCache();
// Refresh cache of load should only be true if the new system isnt the same as the last one AssetBundleUtilities.ClearCache();
if (_refreshCacheOnLoad || !_isChangingStarSystem)
{
ImageUtilities.ClearCache();
AudioUtilities.ClearCache();
AssetBundleUtilities.ClearCache();
}
_refreshCacheOnLoad = false;
IsSystemReady = false; IsSystemReady = false;
} }
@ -466,8 +455,6 @@ namespace NewHorizons
sceneToLoad = OWScene.SolarSystem; sceneToLoad = OWScene.SolarSystem;
} }
_refreshCacheOnLoad = _currentStarSystem != newStarSystem;
_currentStarSystem = newStarSystem; _currentStarSystem = newStarSystem;
LoadManager.LoadSceneAsync(sceneToLoad, true, LoadManager.FadeType.ToBlack, 0.1f, true); LoadManager.LoadSceneAsync(sceneToLoad, true, LoadManager.FadeType.ToBlack, 0.1f, true);