diff --git a/Assets/Mirror/Core/NetworkServer.cs b/Assets/Mirror/Core/NetworkServer.cs index 09c013b34..9ba88d2c6 100644 --- a/Assets/Mirror/Core/NetworkServer.cs +++ b/Assets/Mirror/Core/NetworkServer.cs @@ -930,6 +930,14 @@ public static void ReplaceHandler(Action handle ushort msgType = NetworkMessageId.Id; handlers[msgType] = NetworkMessages.WrapHandler(handler, requireAuthentication, exceptionsDisconnect); } + + /// Replace a handler for message type T. Most should require authentication. + public static void ReplaceHandler(Action handler, bool requireAuthentication = true) + where T : struct, NetworkMessage + { + ushort msgType = NetworkMessageId.Id; + handlers[msgType] = NetworkMessages.WrapHandler(handler, requireAuthentication, exceptionsDisconnect); + } /// Unregister a handler for a message type T. public static void UnregisterHandler() diff --git a/Assets/Mirror/Examples/BenchmarkIdle/MirrorBenchmarkIdle.unity b/Assets/Mirror/Examples/BenchmarkIdle/MirrorBenchmarkIdle.unity index 147bb8048..bae7496f7 100644 --- a/Assets/Mirror/Examples/BenchmarkIdle/MirrorBenchmarkIdle.unity +++ b/Assets/Mirror/Examples/BenchmarkIdle/MirrorBenchmarkIdle.unity @@ -367,6 +367,7 @@ MonoBehaviour: connectionQualityInterval: 3 timeInterpolationGui: 0 spawnAmount: 50000 + spawnAmount: 10000 interleave: 2 spawnPrefab: {fileID: 449802645721213856, guid: 0ea79775d59804682a8cdd46b3811344, type: 3} diff --git a/Assets/Mirror/Examples/Room/Scripts/Reward.cs b/Assets/Mirror/Examples/Room/Scripts/Reward.cs index 989b6e6c1..ac2ced195 100644 --- a/Assets/Mirror/Examples/Room/Scripts/Reward.cs +++ b/Assets/Mirror/Examples/Room/Scripts/Reward.cs @@ -5,9 +5,13 @@ namespace Mirror.Examples.NetworkRoom [RequireComponent(typeof(Common.RandomColor))] public class Reward : NetworkBehaviour { - public bool available = true; + [Header("Components")] public Common.RandomColor randomColor; + [Header("Diagnostics")] + [ReadOnly, SerializeField] + bool available = true; + protected override void OnValidate() { base.OnValidate();