Tinylytics_Config CreateAnalyticsConfigFile() { Tinylytics_Config asset = ScriptableObject.CreateInstance <Tinylytics_Config>(); AssetDatabase.CreateAsset(asset, "Assets/Resources/AnalyticsConfiguration.asset"); AssetDatabase.SaveAssets(); return(asset); }
void OnEnable() { if (EditorPrefs.HasKey("AnalyticsConfigObjectPath")) { string objectPath = EditorPrefs.GetString("AnalyticsConfigObjectPath"); analyticsConfig = AssetDatabase.LoadAssetAtPath(objectPath, typeof(Tinylytics_Config)) as Tinylytics_Config; } }
static void OnBeforeSceneLoadRuntimeMethod() { //Debug.Log("Before first scene loaded"); Tinylytics_Config storage = Resources.Load <Tinylytics_Config>("Tinylytics_URLConfig"); //GameObject instance = GameObject.Instantiate(Resources.Load("AnalyticsManager")) as GameObject; GameObject.Instantiate(Resources.Load("Tinylytics_BackendManager")); BackendManager.SetUniqueURL(storage.uniqueURL); }
void CreateNewConfigFile() { // There is no overwrite protection here! // There is No "Are you sure you want to overwrite your existing object?" if it exists. // This should probably get a string from the user to create a new name and pass it ... analyticsConfig = CreateAnalyticsConfigFile(); if (analyticsConfig) { //initialize it: //inventoryItemList.itemList = new List<InventoryItem>(); string relPath = AssetDatabase.GetAssetPath(analyticsConfig); EditorPrefs.SetString("AnalyticsConfigObjectPath", relPath); } }
void OpenConfigFile() { string absPath = EditorUtility.OpenFilePanel("Select Config File", Application.dataPath, "asset"); if (absPath.StartsWith(Application.dataPath)) { string relPath = absPath.Substring(Application.dataPath.Length - "Assets".Length); analyticsConfig = AssetDatabase.LoadAssetAtPath(relPath, typeof(Tinylytics_Config)) as Tinylytics_Config; //if (analyticsConfig.itemList == null) // inventoryItemList.itemList = new List<InventoryItem>(); if (analyticsConfig) { EditorPrefs.SetString("AnalyticsConfigObjectPath", relPath); } } }