void InitDsgVarsTreeIfNeeded(Rect transitionsRect, DsgVarComponent target) { if (treeviewDsgVars == null || treeviewDsgVarsState == null || treeviewDsgVars.target != target) { treeviewDsgVarsState = new TreeViewState(); bool firstInit = m_MultiColumnHeaderState == null; var headerState = DsgVarsTreeView.CreateDefaultMultiColumnHeaderState(transitionsRect.width); if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_MultiColumnHeaderState, headerState)) { MultiColumnHeaderState.OverwriteSerializedFields(m_MultiColumnHeaderState, headerState); } m_MultiColumnHeaderState = headerState; var multiColumnHeader = new MultiColumnHeader(headerState); if (firstInit) { multiColumnHeader.ResizeToFit(); } var treeModel = new TreeModel <DsgVarsTreeElement>(GetData()); treeviewDsgVars = new DsgVarsTreeView(treeviewDsgVarsState, multiColumnHeader, treeModel) { target = target }; } }