Exemplo n.º 1
0
        void InitIfNeeded()
        {
            InitButonStyles();

            if (!m_Initialized)
            {
                //Init the Node View
                m_nodeView = new ProfilerNodeView(this);
#if UNITY_5_6_OR_NEWER
                // Check if it already exists (deserialized from window layout file or scriptable object)
                if (m_TreeViewState == null)
                {
                    m_TreeViewState = new TreeViewState();
                }

                var headerState = ProfilerTreeView.CreateDefaultMultiColumnHeaderState(multiColumnTreeViewRect.width);
                if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_MultiColumnHeaderState, headerState))
                {
                    MultiColumnHeaderState.OverwriteSerializedFields(m_MultiColumnHeaderState, headerState);
                }
                m_MultiColumnHeaderState = headerState;

                var multiColumnHeader = new MultiColumnHeader(headerState);
                m_TreeModel = new TreeModel <MemoryElement>(GetData());
                m_TreeView  = new ProfilerTreeView(m_TreeViewState, multiColumnHeader, m_TreeModel);
                m_TreeView.doubleClickedCallback += OnDoubleClickCell;
#endif
                // Register the callback for snapshots.
                UnityEditor.MemoryProfiler.MemorySnapshot.OnSnapshotReceived += IncomingSnapshot;

                if (_unpackedCrawl == null && _packedCrawled != null && _packedCrawled.valid)
                {
                    Unpack();
                }

                m_Initialized = true;
            }
        }