protected override void Awake() { EditorApplication.playModeStateChanged -= playModeStateChanged; EditorApplication.playModeStateChanged += playModeStateChanged; wdata = scriptable.Load <NodeCanvasData>(); generateWindowData(wdata); }
/// <summary> /// 当前选择目录下创建 .asset /// </summary> /// <typeparam name="T"></typeparam> /// <param name="name"></param> /// <param name="callback"></param> /// <param name="parameters"></param> /// <returns></returns> public static ScriptableItem CreatAssetCurPath <T>(string name, System.Action <T, Dictionary <string, object> > callback = null, Dictionary <string, object> parameters = null) where T : ScriptableObject { Object[] o = Selection.GetFiltered <Object>(SelectionMode.Assets); if (o == null || o.Length == 0) { return(null); } Object tar = o[0]; string assetpath = AssetDatabase.GetAssetPath(tar); string filename = FileHelper.getFileNameAndTypeByPath(assetpath); if (filename.Contains(".")) { //is file not fold assetpath = assetpath.Replace("/" + filename, null); } string path = assetpath + "/" + name + ".asset"; int num = 1; while (File.Exists(path)) { path = assetpath + "/" + name + num + ".asset"; num++; } ScriptableItem item = new ScriptableItem(path); item.Creat <T>(callback, parameters); T t = item.Load <T>(); t.SelectedObject(); return(item); }