public static void Create() { CreateScriptableObjectWindow window = EditorWindow.GetWindow <CreateScriptableObjectWindow>(true, "Create New Asset"); UnityEngine.Object selection = Selection.GetFiltered <UnityEngine.Object>(SelectionMode.Assets)?.FirstOrDefault(); string path = AssetDatabase.GetAssetPath(selection); if (path == "") { window.folder = ""; } else { path = path.Substring("Assets/".Length); string fullPath = Application.dataPath + "/" + path; if (Directory.Exists(fullPath)) { window.folder = path; } else { window.folder = Directory.GetParent(path).Name; } } window.Show(); }
private static void Init() { CreateScriptableObjectWindow window = (CreateScriptableObjectWindow)EditorWindow.GetWindow(typeof(CreateScriptableObjectWindow)); window.Show(); }