예제 #1
0
        /// <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
            }
        }
예제 #2
0
        /// <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
            }
        }