private void OnAssetLoaded(object sender, EventArgs args) { waitCounter--; if (waitCounter != 0) { return; } PreloadCompleted?.Invoke(this, EventArgs.Empty); }
public void StartPreloading() { bool loadStarted = false; foreach (AssetLoader loader in loaderList) { if (loader.IsReady) { continue; } waitCounter++; loader.AssetLoadedUntyped += OnAssetLoaded; loader.LoadAsset(); loadStarted = true; } if (!loadStarted) { PreloadCompleted?.Invoke(this, EventArgs.Empty); } }