void PopulatePackageList(string search = null) { ListView packageListView = rootVisualElement.Q <ListView>("listView"); packageListView.Clear(); for (int i = 0; i < packageList.Count; i++) { int elementID = i; if (search != null) { if (!packageList[i].name.ToLower().StartsWith(search)) { continue; } } Box listContainer = new Box(); listContainer.name = "listItem"; listContainer.style.height = 30; listContainer.AddManipulator(new Clickable(() => { SelectPackage(elementID); PopulatePackageList(); UpdateRightPanel(); })); Label listLabel = new Label(packageList[i].name); listLabel.style.unityTextAlign = TextAnchor.LowerLeft; listLabel.style.marginLeft = 3; listLabel.style.height = 23; Box separator = new Box(); separator.style.width = new StyleLength(StyleKeyword.Auto); separator.style.height = 2; separator.style.bottom = 0; separator.style.marginTop = new StyleLength(StyleKeyword.Auto); separator.AddToClassList("separator"); listContainer.Add(listLabel); listContainer.Add(separator); packageListView.Insert(packageListView.childCount, listContainer); if (elementID == selectedPackage) { listContainer.style.backgroundColor = new StyleColor(new Color32(48, 48, 48, 255)); } } }