void OnEnable() { _database = (CustomMenuDatabase)target; Scene1Path = serializedObject.FindProperty("_inputValues.ScenePath1"); Scene2Path = serializedObject.FindProperty("_inputValues.ScenePath2"); Scene3Path = serializedObject.FindProperty("_inputValues.ScenePath3"); PrefabSavePath = serializedObject.FindProperty("_inputValues.PrefabSavePath"); }
static void showDataBase() { try{ _inputEditor1 = (CustomMenuDatabase)Resources.Load(CustomMenuDatabasePath, typeof(CustomMenuDatabase)); if (_inputEditor1 == null) { if (!Directory.Exists(Application.dataPath + "/Help Me!/Resources")) { Directory.CreateDirectory(Application.dataPath + "/Help Me!/Resources"); } if (!Directory.Exists(Application.dataPath + "/Help Me!/Resources/")) { Directory.CreateDirectory(Application.dataPath + "/Help Me!/Resources/"); Debug.Log("HelpMe!: Help Me!/Resources folder is required to store settings. it was created "); } const string path = CustomMenuDatabasePath; if (File.Exists(path)) { AssetDatabase.DeleteAsset(path); AssetDatabase.Refresh(); } var asset = ScriptableObject.CreateInstance <CustomMenuDatabase>(); //Assign Values Here if (File.Exists(textFilePath)) { int i = 0; foreach (string s in File.ReadAllLines(textFilePath)) { if (i == 0) { asset._inputValues.ScenePath1 = s; } else if (i == 1) { asset._inputValues.ScenePath2 = s; } else if (i == 2) { asset._inputValues.ScenePath3 = s; } else if (i == 3) { asset._inputValues.PrefabSavePath = s; } else { Debug.Log("Assign This:" + s); } i++; } } AssetDatabase.CreateAsset(asset, path); AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); Debug.LogWarning("HelpMe!: CustomMenuDatabase file didn't exist and was created"); Selection.activeObject = asset; //save reference _inputEditor1 = asset; } } catch (System.Exception e) { Debug.Log("Error getting Settings in InitAPI: " + e.Message); } }