public virtual void InitIfNeeded() { if (m_VisibleRows != null && !m_NeedRefreshVisibleFolders) { return; } if (m_RootItem != null) { m_VisibleRows = !m_TreeView.isSearching ? ExpandedRows(m_RootItem) : Search(m_RootItem, m_TreeView.searchString.ToLower()); } else { Debug.LogError("TreeView root item is null. Ensure that your TreeViewDataSource sets up at least a root item."); m_VisibleRows = new List <TreeViewItem>(); } m_NeedRefreshVisibleFolders = false; if (onVisibleRowsChanged != null) { onVisibleRowsChanged(); } m_TreeView.Repaint(); }