Exemple #1
0
    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();
    }
Exemple #2
0
    private static void Init()
    {
        CreateScriptableObjectWindow window = (CreateScriptableObjectWindow)EditorWindow.GetWindow(typeof(CreateScriptableObjectWindow));

        window.Show();
    }