public void Refresh() { if (this.hierarchyScrollRect.normalizedPosition.y.ApproxZero()) { this.scrollPosition = this.hierarchyScrollRect.normalizedPosition; } this.hierarchyScrollLayoutGroup.ClearItems(); this.hierarchyScrollLayoutGroup.SelectedItem = null; var hierarchies = this.GetAllHierarchyPath(); for (var i = 0; i < hierarchies.Length; i++) { var hierarchyPath = hierarchies[i]; if (!string.IsNullOrEmpty(Filter)) { if (hierarchyPath.IndexOf(Filter, StringComparison.OrdinalIgnoreCase) < 0) { continue; } } var hierarchyEntry = new HierarchyEntry(hierarchyPath); this.hierarchyScrollLayoutGroup.AddItem(hierarchyEntry); } }
public void SetDataContext(object data) { var path = data as HierarchyEntry; if (path == null) { throw new Exception("Data should be a HierarchyEntry"); } // Only update everything else if data context has changed, not just for an update if (path == this.prevData) { return; } this.prevData = path; this.hierarchyPathPreview.text = path.PathPreview; }
private void PopulateFullPathArea(HierarchyEntry entry) { if (entry == null) { this.hierarchyPathText.text = ""; } else { var text = entry.HierarchyPath + System.Environment.NewLine + "-- Attached Components --"; var targetObject = GameObject.Find(entry.HierarchyPath); foreach (var component in targetObject.GetComponents <Component>()) { text = text + System.Environment.NewLine + component.GetType().Name; } this.hierarchyPathText.text = text.Substring(0, Mathf.Min(text.Length, MaxLength)); } this.fullPathScrollRect.normalizedPosition = new Vector2(0, 1); }