KcpTransport: OnGUIStatistics helper function for easier OnGUI overwrites

This commit is contained in:
vis2k 2023-03-04 22:23:10 +08:00
parent 7b1d6fd412
commit 582a02eec8

View File

@ -277,12 +277,8 @@ public static string PrettyBytes(long bytes)
return $"{(bytes / (1024f * 1024f * 1024f)):F2} GB";
}
// OnGUI allocates even if it does nothing. avoid in release.
#if UNITY_EDITOR || DEVELOPMENT_BUILD
protected virtual void OnGUI()
protected virtual void OnGUIStatistics()
{
if (!statisticsGUI) return;
GUILayout.BeginArea(new Rect(5, 110, 300, 300));
if (ServerActive())
@ -314,6 +310,13 @@ protected virtual void OnGUI()
GUILayout.EndArea();
}
// OnGUI allocates even if it does nothing. avoid in release.
#if UNITY_EDITOR || DEVELOPMENT_BUILD
protected virtual void OnGUI()
{
if (statisticsGUI) OnGUIStatistics();
}
#endif
protected virtual void OnLogStatistics()