private void OnDestroy() { if (!GameFoundationSdk.IsInitialized) { Debug.Log("Game Foundation is not initialized."); return; } GameFoundationSdk.Uninitialize(); }
public void Load() { GameFoundationSdk.Uninitialize(); if (_dataLayer?.persistence == null) { Debug.LogError("DataLayer is null."); return; } Deferred def = GameFoundationSdk.Initialize(_dataLayer); if (def.isDone) { if (def.isFulfilled) { _onInitOrLoadComplete?.Invoke(); OnInitOrLoadComplete?.Invoke(); } else { Debug.LogError(def.error.Message); _onInitOrLoadFail?.Invoke(); } } else { IEnumerator Routine(Deferred aDef) { yield return(aDef.Wait()); if (aDef.isFulfilled) { _onInitOrLoadComplete?.Invoke(); OnInitOrLoadComplete?.Invoke(); } else { Debug.LogError(aDef.error.Message); _onInitOrLoadFail?.Invoke(); } } StartCoroutine(Routine(def)); } }