Skip to content

Commit d7d3932

Browse files
committed
Added properties for accessing the average fps and ms.
1 parent 6a16a94 commit d7d3932

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Runtime/DevConsole.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,24 @@ public static bool IsKeyBindingsEnabled
8686
}
8787

8888
/// <summary>
89-
/// The key used to toggle the dev console window, NULL if no key.
89+
/// Key used to toggle the dev console window, NULL if no key.
9090
/// </summary>
9191
public static InputKey? ToggleKey
9292
{
9393
get => _console.ConsoleToggleKey;
9494
set => _console.ConsoleToggleKey = value;
9595
}
9696

97+
/// <summary>
98+
/// Current average FPS. -1 if the fps is not being calculated.
99+
/// </summary>
100+
public static int AverageFps => _console.AverageFps;
101+
102+
/// <summary>
103+
/// Current average milliseconds per frame (in seconds). -1 if the fps is not being calculated.
104+
/// </summary>
105+
public static float AverageMs => _console.AverageMs;
106+
97107
#endregion
98108

99109
#region Events

Runtime/DevConsoleMono.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,16 @@ internal sealed class DevConsoleMono : MonoBehaviour
448448
/// </summary>
449449
internal bool BindingsIsEnabled { get; set; } = true;
450450

451+
/// <summary>
452+
/// Average fps. -1 if fps is not being calcualted.
453+
/// </summary>
454+
internal int AverageFps => _isDisplayingFps ? _fps : -1;
455+
456+
/// <summary>
457+
/// Average ms per frame. -1 if fps is not being calculated.
458+
/// </summary>
459+
internal float AverageMs => _isDisplayingFps ? _fpsMs : -1f;
460+
451461
/// <summary>
452462
/// The text entered by the user in the input field.
453463
/// </summary>

0 commit comments

Comments
 (0)