void DeleteAsset(UnityEngine.Object obj) { if (GUILayout.Button("Del", GUILayout.Width(30))) { string assetPath = AssetDatabase.GetAssetPath(obj); AssetDatabase.MoveAssetToTrash(assetPath); TPAchievementDesigner.UpdateManager(); DrawTool(); } }
public static void OpenWindow() { if (EditorApplication.isPlaying) { Debug.Log("You can't change Achievement Manager Designer runtime!"); return; } window = (TPAchievementDesigner)GetWindow(typeof(TPAchievementDesigner)); currentScene = EditorSceneManager.GetActiveScene().name; EditorApplication.hierarchyWindowChanged += hierarchyWindowChanged; window.minSize = new Vector2(615, 290); window.maxSize = new Vector2(615, 290); window.Show(); }
public void OpenCreator() { if (TPAchievementCreator.DebugMode) { if (serializedObject.targetObject.hideFlags != HideFlags.NotEditable) { serializedObject.targetObject.hideFlags = HideFlags.NotEditable; } return; } if (serializedObject.targetObject.hideFlags != HideFlags.None) { serializedObject.targetObject.hideFlags = HideFlags.None; } if (GUILayout.Button("Open Achievement Manager", GUILayout.Height(30))) { TPAchievementDesigner.OpenWindow(); } }
void CreateScriptable() { string assetPath = TPAchievementDesigner.EditorData.Paths[0]; string newAssetPath = assetPath; UnityEngine.Object newObj = null; newObj = ScriptableObject.CreateInstance <TPAchievement>(); newAssetPath += "New Achievement.asset"; if (!AssetDatabase.IsValidFolder(assetPath)) { System.IO.Directory.CreateDirectory(assetPath); } AssetDatabase.CreateAsset(newObj, AssetDatabase.GenerateUniqueAssetPath(newAssetPath)); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); AssetDatabase.OpenAsset(newObj); Debug.Log(newObj.name + " created in " + assetPath); TPAchievementDesigner.UpdateManager(); DrawTool(); }