private void SetSelectTextAsset(TextAsset textAsset) { byte[] bytes = textAsset.bytes; if (bytes != null && bytes.Length > 0) { GraphData = VisualGraphData.Read(bytes); GraphData.Link(); WindowOffset = Vector2.zero; var path = AssetDatabase.GetAssetPath(textAsset); SavePath = path; } }
void LoadNode() { var path = EditorUtility.OpenFilePanel("select a node file", OutPutNodesPath + DefaultNodesPath, "bytes"); Debug.Log(path); var assetPath = path.Replace(Application.dataPath.Replace("Assets", ""), ""); TextAsset txtAsset = AssetDatabase.LoadAssetAtPath <TextAsset>(assetPath); if (txtAsset.bytes != null && txtAsset.bytes.Length > 0) { var gd = VisualGraphData.Read(txtAsset.bytes); gd.Link(); Nodes.AddRange(gd.Nodes); } SavePath = assetPath; }