void InitializeAssetList() { onProjectChange += RefreshList; createAssetIcon = new GUIContent(EditorGUIUtility.FindTexture("CreateAddNew"), "创建Asset"); searchField = new SearchField(); searchField.autoSetFocusOnFindCommand = true; projecListTreeView = BuildAssetsListTreeView(); projecListTreeView.Reload(); }
protected virtual TimelineLitesTreeView BuildAssetsListTreeView() { TimelineLitesTreeView projecListTreeView = new TimelineLitesTreeView(TreeViewState, searchText, this); // 查找所有使用此类的ScriptableObjects string[] guids = AssetDatabase.FindAssets("t:" + TimelineLiteAssetType); for (int i = 0; i < guids.Length; i++) { string assetPath = AssetDatabase.GUIDToAssetPath(guids[i]); TimelineLiteAsset asset = AssetDatabase.LoadAssetAtPath <TimelineLiteAsset>(assetPath); TimelineLiteAssetTreeViewItem assetTreeViewItem = new TimelineLiteAssetTreeViewItem(asset); projecListTreeView.AddItem(asset.GetType().Name, assetTreeViewItem); } return(projecListTreeView); }
public void RefreshList() { projecListTreeView.Clear(); projecListTreeView = BuildAssetsListTreeView(); projecListTreeView.Reload(); }