protected override void OnGUIMain()
        {
            NavmeshBuild build = Context.Build;

            if (!build)
            {
                return;
            }

            Rect statusArea = Context.MainArea;

            if (build.BuildState == NavmeshBuildState.Invalid)
            {
                return;
            }

            InputBuildInfo info;
            InputGeometry  geometry       = null;
            ConnectionSet  connections    = null;
            int            triCount       = 0;
            int            processorCount = 0;

            ViewOption viewFlags = 0;
            bool       hasData   = false;

            string topLabel;

            if (mCompiler != null)
            {
                if (mCompiler.IsFinished)
                {
                    if (mCompiler.HasData)
                    {
                        topLabel = "Input successfully compiled. (Needs to be accepted.)";
                    }
                    else
                    {
                        topLabel = "No input data produced.";
                    }
                }
                else
                {
                    topLabel = "Compiling";
                }

                info           = mCompiler.Info;
                geometry       = mCompiler.Geometry;
                connections    = mCompiler.Connections;
                triCount       = mCompiler.TriCount;
                processorCount = (mCompiler.Processors == null ? 0 : mCompiler.Processors.Length);

                if (geometry != null)
                {
                    hasData = true;
                }
            }
            else if (build.HasInputData)
            {
                topLabel = "Current Input";

                viewFlags = (ViewOption.Input | ViewOption.Grid);

                info           = build.InputInfo;
                geometry       = build.InputGeom;
                connections    = build.Connections;
                triCount       = geometry.TriCount;
                processorCount = build.NMGenProcessors.Count;

                hasData = true;
            }
            else
            {
                topLabel = "Input needs to be compiled.";
                info     = new InputBuildInfo();
            }

            DebugContext.SetViews(viewFlags);

            if (!hasData && triCount > 0)
            {
                GUI.Box(Context.MainArea
                        , string.Format("{0} {1:N0} triangles", topLabel, triCount)
                        , EditorUtil.HelpStyle);

                OnGUICompiler(statusArea);

                return;
            }

            GUILayout.BeginArea(statusArea, GUI.skin.box);

            string currScene = System.IO.Path.GetFileName(SceneManager.GetActiveScene().path);

            int idx = currScene.LastIndexOf(".");

            if (idx >= 0)
            {
                currScene = currScene.Substring(0, idx);
            }

            if (currScene.Length == 0)
            {
                currScene = "None";
            }

            GUILayout.BeginHorizontal();

            GUILayout.Label("Input scene:");

            GUILayout.Label(" Current: " + currScene);

            GUILayout.Label(" Last: "
                            + NavEditorUtil.SceneDisplayName(build.BuildTarget.BuildInfo));

            GUILayout.EndHorizontal();

            if (NavEditorUtil.SceneMismatch(build.BuildTarget.BuildInfo))
            {
                GUILayout.Box("Current scene does not match last input scene."
                              , EditorUtil.WarningStyle);
            }

            GUILayout.Space(MarginSize);

            GUILayout.Label(topLabel);

            if (hasData)
            {
                GUILayout.Space(ControlUtil.MarginSize * 3);

                GUILayout.BeginHorizontal();

                GUILayout.BeginVertical();

                GUILayout.Label("Geometry");

                GUILayout.Space(ControlUtil.MarginSize);

                GUILayout.Label(string.Format("Triangles: {0:N0}", triCount));

                GUILayout.Space(ControlUtil.MarginSize);

                GUILayout.Label("Min Bounds: " + Vector3Util.ToString(geometry.BoundsMin));

                GUILayout.Label("Max Bounds: " + Vector3Util.ToString(geometry.BoundsMax));

                GUILayout.Space(ControlUtil.MarginSize);

                UnityEngine.Vector3 diff = (geometry.BoundsMax - geometry.BoundsMin).ToUnityVector3();
                GUILayout.Label(string.Format("WxHxD: {0:f3} x {1:f3} x {2:f3}"
                                              , diff.x, diff.y, diff.z));

                GUILayout.Space(ControlUtil.MarginSize * 2);

                // Note: The build press interprets zero root objects as a global search.

                GUILayout.Space(ControlUtil.MarginSize);
                GUILayout.Label("Components");
                GUILayout.Space(ControlUtil.MarginSize);

                GUILayout.Label("Pre-filter: " + info.compCountPre);
                GUILayout.Label("Post-filter: " + info.compCountPost);

                GUILayout.EndVertical();

                GUILayout.BeginVertical();

                GUILayout.Label("Modifiers");

                GUILayout.Space(ControlUtil.MarginSize);

                GUILayout.Label("Component loaders: " + info.loaderCount);
                GUILayout.Label("Component filters: " + info.filterCount);
                GUILayout.Label("Area assignment: " + info.areaModifierCount);
                GUILayout.Label("Component compilers: " + info.compilerCount);
                GUILayout.Label("Input post-processors: " + info.postCount);
                GUILayout.Label("NMGen processors: " + processorCount);
                GUILayout.Label("Off-Mesh connections: " + connections.Count);

                GUILayout.EndVertical();

                GUILayout.EndHorizontal();
            }

            GUILayout.EndArea();

            OnGUICompiler(statusArea);
        }
        protected override void OnGUIMain()
        {
            NavmeshBuild build = Context.Build;

            if (!build)
                return;
            
            Rect statusArea = Context.MainArea;

            if (build.BuildState == NavmeshBuildState.Invalid)
                return;

            InputBuildInfo info;
            InputGeometry geometry = null;
            ConnectionSet connections = null;
            int triCount = 0;
            int processorCount = 0;

            ViewOption viewFlags = 0;
            bool hasData = false;

            string topLabel;

            if (mCompiler != null)
            {
                if (mCompiler.IsFinished)
                {
                    if (mCompiler.HasData)
                        topLabel = "Input successfully compiled. (Needs to be accepted.)";
                    else
                        topLabel = "No input data produced.";
                }
                else
                    topLabel = "Compiling";

                info = mCompiler.Info;
                geometry = mCompiler.Geometry;
                connections = mCompiler.Connections;
                triCount = mCompiler.TriCount;
                processorCount = (mCompiler.Processors == null ? 0 : mCompiler.Processors.Length);

                if (geometry != null)
                    hasData = true;
            }
            else if (build.HasInputData)
            {
                topLabel = "Current Input";

                viewFlags = (ViewOption.Input | ViewOption.Grid);

                info = build.InputInfo;
                geometry = build.InputGeom;
                connections = build.Connections;
                triCount = geometry.TriCount;
                processorCount = build.NMGenProcessors.Count;

                hasData = true;
            }
            else
            {
                topLabel = "Input needs to be compiled.";
                info = new InputBuildInfo();
            }

            DebugContext.SetViews(viewFlags);

            if (!hasData && triCount > 0)
            {
                GUI.Box(Context.MainArea
                    , string.Format("{0} {1:N0} triangles", topLabel, triCount)
                    , EditorUtil.HelpStyle);

                OnGUICompiler(statusArea);

                return;
            }

            GUILayout.BeginArea(statusArea, GUI.skin.box);

            string currScene = System.IO.Path.GetFileName(EditorApplication.currentScene);

            int idx = currScene.LastIndexOf(".");
            if (idx >= 0)
                currScene = currScene.Substring(0, idx);

            if (currScene.Length == 0)
                currScene = "None";

            GUILayout.BeginHorizontal();

            GUILayout.Label("Input scene:");

            GUILayout.Label(" Current: " + currScene);

            GUILayout.Label(" Last: "
                + NavEditorUtil.SceneDisplayName(build.BuildTarget.BuildInfo));

            GUILayout.EndHorizontal();

            if (NavEditorUtil.SceneMismatch(build.BuildTarget.BuildInfo))
            {
                GUILayout.Box("Current scene does not match last input scene."
                    , EditorUtil.WarningStyle);
            }

            GUILayout.Space(MarginSize);

            GUILayout.Label(topLabel);

            if (hasData)
            {
                GUILayout.Space(ControlUtil.MarginSize * 3);

                GUILayout.BeginHorizontal();

                GUILayout.BeginVertical();

                GUILayout.Label("Geometry");

                GUILayout.Space(ControlUtil.MarginSize);

                GUILayout.Label(string.Format("Triangles: {0:N0}", triCount));

                GUILayout.Space(ControlUtil.MarginSize);

                GUILayout.Label("Min Bounds: " + Vector3Util.ToString(geometry.BoundsMin));

                GUILayout.Label("Max Bounds: " + Vector3Util.ToString(geometry.BoundsMax));

                GUILayout.Space(ControlUtil.MarginSize);

                Vector3 diff = geometry.BoundsMax - geometry.BoundsMin;
                GUILayout.Label(string.Format("WxHxD: {0:f3} x {1:f3} x {2:f3}"
                    , diff.x, diff.y, diff.z));

                GUILayout.Space(ControlUtil.MarginSize * 2);

                // Note: The build press interprets zero root objects as a global search.
                    
                GUILayout.Space(ControlUtil.MarginSize);
                GUILayout.Label("Components");
                GUILayout.Space(ControlUtil.MarginSize);

                GUILayout.Label("Pre-filter: " + info.compCountPre);
                GUILayout.Label("Post-filter: " + info.compCountPost);

                GUILayout.EndVertical();

                GUILayout.BeginVertical();

                GUILayout.Label("Modifiers");

                GUILayout.Space(ControlUtil.MarginSize);

                GUILayout.Label("Component loaders: " + info.loaderCount);
                GUILayout.Label("Component filters: " + info.filterCount);
                GUILayout.Label("Area assignment: " + info.areaModifierCount);
                GUILayout.Label("Component compilers: " + info.compilerCount);
                GUILayout.Label("Input post-processors: " + info.postCount);
                GUILayout.Label("NMGen processors: " + processorCount);
                GUILayout.Label("Off-Mesh connections: " + connections.Count);

                GUILayout.EndVertical();

                GUILayout.EndHorizontal();
            }

            GUILayout.EndArea();

            OnGUICompiler(statusArea);
        }