Ejemplo n.º 1
0
    public static NodeGraph getSavedGroupNode(NodeGraph currentGraph)
    {
        string graphPath = EditorUtility.OpenFilePanel("Load Graph", Application.dataPath + "/SimpleMathNodeEditor/Database/", "");

        Debug.Log(graphPath);

        int pathLength = Application.dataPath.Length;
        int pathLengthWithName = (Application.dataPath + "/SimpleMathNodeEditor/Database/").Length;

        string finalPath = graphPath.Substring(pathLength - 6); // remove .asset extension from Path
        string groupNodeName = graphPath.Substring(pathLengthWithName);
        groupNodeName = groupNodeName.Remove(groupNodeName.Length - 6);

        string newPath = "Assets/SimpleMathNodeEditor/Database/" + currentGraph.graphName + "_Sub_" + groupNodeName + currentGraph.getGroupNodeCountByName(groupNodeName) + ".asset"; // remove .asset extension from Path

        AssetDatabase.CopyAsset(finalPath, newPath);

        return (NodeGraph)AssetDatabase.LoadAssetAtPath(newPath, typeof(NodeGraph));
    }
Ejemplo n.º 2
0
    public static NodeGraph getSavedGroupNode(NodeGraph currentGraph, string path, string name)
    {
        int pathLength = Application.dataPath.Length;
        int pathLengthWithName = (Application.dataPath + "/SimpleMathNodeEditor/Database/").Length;

        string finalPath = path.Substring(pathLength - 6); // remove .asset extension from Path

        string newPath = "Assets/SimpleMathNodeEditor/Database/" + currentGraph.graphName + "_Sub_" + name + currentGraph.getGroupNodeCountByName(name) + ".asset"; // remove .asset extension from Path

        AssetDatabase.CopyAsset(finalPath, newPath);

        return (NodeGraph)AssetDatabase.LoadAssetAtPath(newPath, typeof(NodeGraph));
    }