KcpTransport: virtual Awake/OnValidate/OnGUI to allow inheritance more easily

This commit is contained in:
vis2k 2023-03-04 22:20:54 +08:00
parent def24f8510
commit 7b1d6fd412

View File

@ -92,7 +92,7 @@ public static TransportError ToTransportError(ErrorCode error)
}
}
void Awake()
protected virtual void Awake()
{
// logging
// Log.Info should use Debug.Log if enabled, or nothing otherwise
@ -130,7 +130,7 @@ void Awake()
Debug.Log("KcpTransport initialized!");
}
void OnValidate()
protected virtual void OnValidate()
{
// show max message sizes in inspector for convenience
ReliableMaxMessageSize = KcpPeer.ReliableMaxMessageSize(ReceiveWindowSize);
@ -279,7 +279,7 @@ public static string PrettyBytes(long bytes)
// OnGUI allocates even if it does nothing. avoid in release.
#if UNITY_EDITOR || DEVELOPMENT_BUILD
void OnGUI()
protected virtual void OnGUI()
{
if (!statisticsGUI) return;
@ -316,7 +316,7 @@ void OnGUI()
}
#endif
void OnLogStatistics()
protected virtual void OnLogStatistics()
{
if (ServerActive())
{