void LoadActivePattern(ColorDepth colorDepth) { searchLabels = new List { "Torso pattern", styleIndex.ToString(), activeTradition.ToString(), colorDepth.ToString() }; Addressables.LoadResourceLocationsAsync(searchLabels, Addressables.MergeMode.Intersection).Completed += async locationAsyncHandle => { if (locationAsyncHandle.IsDone) { var patternLocations = locationAsyncHandle.Result.ToList(); if(patternLocations==null || patternLocations.Count <= 0) { Debug.Log("<<<<<<<<<<>>>>>>>>>>>>"); var style = Enum.GetName(typeof(JerseyStyle), styleIndex); Debug.Log("Loading jerseys of style: " + style); Debug.Log("Style index: " + searchLabels[1]); Debug.Log("Tradition: " + searchLabels[2]); Debug.Log("Color depth: " + searchLabels[3]); throw new Exception("Failed to load jersey pattern!"); } var sortedLocation = ListUtilities.RandomItemOf(patternLocations); Addressables.LoadAssetAsync(sortedLocation).Completed += async dataAsyncHandle => { if (dataAsyncHandle.IsDone) { if (isCacheOnly) { OnCacheFinishRaiser(); isCacheOnly = false; //Debug.Log("Jersey cache finished!"); return; } choosenPattern = dataAsyncHandle.Result; OnLoadRaiser(choosenPattern); OnReadyRaiser(); UpdateAsyncOperationHandle(dataAsyncHandle); Addressables.Release(dataAsyncHandle.Result); /* If I release the result, the system works around 70% of the time and if I don't, the RAM usage is cumulative which isn't sustainable!*/ } else { await dataAsyncHandle.Task; throw new Exception("No valid patterns of style were found at "+sortedLocation); } }; } else { await locationAsyncHandle.Task; throw new Exception("No valid patterns of style " + sortedGraphicProfile.style + " " + sortedGraphicProfile.colorDepth + " were found!"); } }; }