protected override TreeViewItem BuildRoot() { var root = new AssetReferenceTreeItem(); foreach (var a in m_assets) { root.AddChild(new AssetReferenceTreeItem(a)); } return(root); }
private void CellGUI(Rect cellRect, AssetReferenceTreeItem item, int column, ref RowGUIArgs args) { Color oldColor = GUI.color; CenterRectUsingSingleLineHeight(ref cellRect); GUI.color = Color.white; switch (column) { case 0: { var iconRect = new Rect(cellRect.x + 1, cellRect.y + 1, cellRect.height - 2, cellRect.height - 2); var icon = item.icon; if (icon != null) { GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit); } DefaultGUI.Label( new Rect(cellRect.x + iconRect.xMax + 1, cellRect.y, cellRect.width - iconRect.width, cellRect.height), item.displayName, args.selected, args.focused); } break; case 1: DefaultGUI.Label(cellRect, item.asset.variantName, args.selected, args.focused); break; case 2: DefaultGUI.Label(cellRect, item.fileSize, args.selected, args.focused); break; case 3: DefaultGUI.Label(cellRect, item.runtimeMemorySize, args.selected, args.focused); break; } GUI.color = oldColor; }