/// <summary> /// Initiate shop manager initialization on scene change. /// </summary> public void OnLevelWasLoaded(int level) { if (instance != this) { return; } ShopManager shop = null; GameObject shopGO = GameObject.Find("ShopManager"); if (shopGO) { shop = shopGO.GetComponent <ShopManager>(); } if (shop) { shop.Init(); #if !UNITY_EDITOR if (controller != null) { ShopManager.OverwriteWithFetch(controller.products.all); } #endif } }
/// <summary> /// Detect and initiate the ShopManager initialization on scene changes. /// </summary> public void OnSceneWasLoaded(Scene scene, LoadSceneMode m) { if (instance != this) { return; } ShopManager shop = null; GameObject shopGO = GameObject.Find("ShopManager"); if (shopGO) { shop = shopGO.GetComponent <ShopManager>(); } if (shop) { shop.Init(); #if UNITY_PURCHASING && (!UNITY_EDITOR || PLAYFAB) if (controller != null) { ShopManager.OverwriteWithFetch(controller.products.all); } #endif } }