Skip to content

Commit 32267fa

Browse files
committed
2 parents 8315efa + 9be210b commit 32267fa

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,38 @@
22
A fast and (almost) garbage free debug overlay for Unity. The projects contains two primary components: a debug overlay
33
and a console.
44

5-
# Debug overlay
6-
The debug overlay, useful for displaying text and graphs that update every frame.
7-
Like this: ![Pretty picture](https://user-images.githubusercontent.com/4175246/28583020-e34a3a12-7167-11e7-8871-7199f410aa8d.gif)
5+
## Performance
6+
Garbage production is minimized by not really using strings a lot and by having convenience functions that mimick string
7+
formatting (using format strings like `"This: {0}"`) known from C#. Rendering happens through the magic of a few procedural draw calls
8+
and is quite fast.
9+
10+
## Debug overlay
11+
The debug overlay is useful for displaying text and graphs that update every frame.
12+
Like this:
13+
14+
![Pretty picture](https://user-images.githubusercontent.com/4175246/28583020-e34a3a12-7167-11e7-8871-7199f410aa8d.gif)
815

916
This can be done with some level of convenience using this code:
1017

1118
```c#
12-
// FPS in top left corner
19+
// FPS in top left corner
1320
DebugOverlay.Write(1, 0, "FPS:{0,6:###.##}", 1.0f / Time.deltaTime);
1421

1522
// Small graph of FPS below
1623
fpsHistory[Time.frameCount % fpsHistory.Length] = 1.0f / Time.deltaTime;
1724
DebugOverlay.DrawGraph(1, 1, 9, 1.5f, fpsHistory, Time.frameCount % fpsHistory.Length, Color.green);
1825
```
1926

20-
Even though it involves string formatting, not garbage will be generated.
27+
Even though it looks like regular string formatting, no garbage will be generated.
2128

22-
# Console
29+
## Console
2330
The console is useful for checking logs / output while ingame and also for easily registrering commands
2431
that can be used to tweak the game behaviour or turn on/off debugging aspects.
2532

26-
You can write stuff like
33+
You can write
2734

2835
```c#
29-
30-
// Register quit command
36+
// Register quit command
3137
Game.console.AddCommand("quit", CmdQuit, "Quit game");
3238

3339
/* ... */
@@ -37,12 +43,9 @@ You can write stuff like
3743
Game.console.
3844
Application.Quit();
3945
}
40-
41-
42-
4346
```
4447

45-
and it will look like this
48+
and it will work like this:
4649

4750
![Pretty picture](https://user-images.githubusercontent.com/4175246/28582984-d215e5f2-7167-11e7-99ff-e96b2981b9bb.gif)
4851

0 commit comments

Comments
 (0)