private void OnEnable() { try { labelStyle = new GUIStyle(EditorStyles.label); } catch { } iapSettings = Resources.Load <IAPSettings>("IAPData"); if (iapSettings == null) { CreateIAPSettings(); iapSettings = Resources.Load <IAPSettings>("IAPData"); } debug = iapSettings.debug; useReceiptValidation = iapSettings.useReceiptValidation; usePlaymaker = iapSettings.usePlaymaker; useBolt = iapSettings.useBolt; useGameFlow = iapSettings.useGameFlow; useForGooglePlay = iapSettings.useForGooglePlay; useForAmazon = iapSettings.useForAmazon; useForIos = iapSettings.useForIos; localShopProducts = new List <StoreProduct>(); for (int i = 0; i < iapSettings.shopProducts.Count; i++) { localShopProducts.Add(iapSettings.shopProducts[i]); } }
private void CreateIAPSettings() { IAPSettings asset = ScriptableObject.CreateInstance <IAPSettings>(); if (!AssetDatabase.IsValidFolder("Assets/GleyPlugins/EasyIAP/Resources")) { AssetDatabase.CreateFolder("Assets/GleyPlugins/EasyIAP", "Resources"); AssetDatabase.Refresh(); } AssetDatabase.CreateAsset(asset, "Assets/GleyPlugins/EasyIAP/Resources/IAPData.asset"); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }