void OnPostRender() { GL.PushMatrix(); if (Camera.main != null) { GL.LoadProjectionMatrix(Camera.main.projectionMatrix); GL.modelview = Camera.main.worldToCameraMatrix; } if (_lineMaterial == null) { _lineMaterial = new Material(Shader.Find("LinesHelper/ColoredBlended")); _lineMaterial.hideFlags = HideFlags.HideAndDontSave; } _lineMaterial.SetPass(0); // Avoid GC Alloc _systems.Clear(); Dictionary <IDebuggable, SystemInfo> .Enumerator iter = _gameSystems.GetEnumerator(); while (iter.MoveNext()) { _systems.Add(iter.Current.Key); } iter.Dispose(); for (int i = 0, cnt = _systems.Count; i < cnt; ++i) { IDebuggable system = _systems[i]; if (IsEnabled(system)) { system.OnDrawDebug(); } } GL.PopMatrix(); }