void InitRenderChain()
        {
            renderChain = CreateRenderChain();

            if (attachedPanel.visualTree != null)
            {
                renderChain.UIEOnChildAdded(null, attachedPanel.visualTree, 0);
            }

            OnPanelStandardShaderChanged();
            if (panel.contextType == ContextType.Player)
            {
                OnPanelStandardWorldSpaceShaderChanged();
            }
        }
 void OnPanelChanged(BaseVisualElementPanel obj)
 {
     DisposeRenderChain();
     if (panel != null)
     {
         renderChain = CreateRenderChain();
         if (panel.visualTree != null)
         {
             renderChain.UIEOnChildAdded(panel.visualTree.hierarchy.parent, panel.visualTree,
                                         panel.visualTree.hierarchy.parent == null ? 0 : panel.visualTree.hierarchy.parent.IndexOf(panel.visualTree));
             renderChain.UIEOnVisualsChanged(panel.visualTree, true);
         }
         panel.standardShaderChanged += OnPanelStandardShaderChanged;
         panel.hierarchyChanged      += OnPanelHierarchyChanged;
     }
 }
        void OnPanelHierarchyChanged(VisualElement ve, HierarchyChangeType changeType)
        {
            if (renderChain == null)
            {
                return;
            }

            switch (changeType)
            {
            case HierarchyChangeType.Add:
                renderChain.UIEOnChildAdded(ve.hierarchy.parent, ve, ve.hierarchy.parent != null ? ve.hierarchy.parent.IndexOf(ve) : 0);
                break;

            case HierarchyChangeType.Remove:
                renderChain.UIEOnChildRemoving(ve);
                break;

            case HierarchyChangeType.Move:
                renderChain.UIEOnChildrenReordered(ve);
                break;
            }
        }