private void InitIfNeeded(ProfilerWindow win)
{
if (m_ZoomablePreview != null)
{
return;
}
m_ZoomablePreview = new ZoomableArea(true, false)
{
hRangeMin = 0.0f,
vRangeMin = 0.0f,
hRangeMax = 1.0f,
vRangeMax = 1.0f
};
m_ZoomablePreview.SetShownHRange(0, 1);
m_ZoomablePreview.SetShownVRange(0, 1);
m_ZoomablePreview.uniformScale = true;
m_ZoomablePreview.scaleWithWindow = true;
var initwidth = 100;
var maxWidth = 200;
m_MulticolumnHeaderState = new MultiColumnHeaderState(new[]
{
new MultiColumnHeaderState.Column {
headerContent = EditorGUIUtility.TrTextContent("Object"), width = 220, maxWidth = 400, canSort = true
},
new MultiColumnHeaderState.Column {
headerContent = EditorGUIUtility.TrTextContent("Self Batch Count"), width = initwidth, maxWidth = maxWidth
},
new MultiColumnHeaderState.Column {
headerContent = EditorGUIUtility.TrTextContent("Cumulative Batch Count"), width = initwidth, maxWidth = maxWidth
},
new MultiColumnHeaderState.Column {
headerContent = EditorGUIUtility.TrTextContent("Self Vertex Count"), width = initwidth, maxWidth = maxWidth
},
new MultiColumnHeaderState.Column {
headerContent = EditorGUIUtility.TrTextContent("Cumulative Vertex Count"), width = initwidth, maxWidth = maxWidth
},
new MultiColumnHeaderState.Column
{
headerContent = EditorGUIUtility.TrTextContent("Batch Breaking Reason"),
width = 220,
maxWidth = 400,
canSort = false
},
new MultiColumnHeaderState.Column {
headerContent = EditorGUIUtility.TrTextContent("GameObject Count"), width = initwidth, maxWidth = 400
},
new MultiColumnHeaderState.Column {
headerContent = EditorGUIUtility.TrTextContent("GameObjects"), width = 150, maxWidth = 400, canSort = false
},
});
foreach (var column in m_MulticolumnHeaderState.columns)
{
column.sortingArrowAlignment = TextAlignment.Right;
}
m_UGUIProfilerTreeViewState = new UISystemProfilerTreeView.State {
profilerWindow = win
};
var multiColumnHeader = new Headers(m_MulticolumnHeaderState)
{
canSort = true, height = 21
};
multiColumnHeader.sortingChanged += header => { m_TreeViewControl.Reload(); };
m_TreeViewControl = new UISystemProfilerTreeView(m_UGUIProfilerTreeViewState, multiColumnHeader);
m_TreeViewControl.Reload();
}