File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
com.unity.netcode.gameobjects/Runtime/Messaging Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
33using Unity . Netcode ;
4+ using UnityEditor ;
45using UnityEngine ;
56
67internal static class MessageDelivery
@@ -20,6 +21,12 @@ internal static class MessageDelivery
2021 [ RuntimeInitializeOnLoadMethod ]
2122 private static void OnApplicationStart ( )
2223 {
24+ UpdateMessageTypes ( ) ;
25+ }
26+
27+ private static void UpdateMessageTypes ( )
28+ {
29+ s_MessageToDelivery . Clear ( ) ;
2330 var networkMessageTypes = Enum . GetValues ( typeof ( NetworkMessageTypes ) ) ;
2431 foreach ( var messageTypeObject in networkMessageTypes )
2532 {
@@ -33,6 +40,15 @@ private static void OnApplicationStart()
3340 s_MessageToMessageType = ILPPMessageProvider . GetMessageTypesMap ( ) ;
3441 }
3542
43+ #if UNITY_EDITOR
44+ [ InitializeOnLoadMethod ]
45+ [ InitializeOnEnterPlayMode ]
46+ private static void OnEnterPlayMode ( )
47+ {
48+ UpdateMessageTypes ( ) ;
49+ }
50+ #endif
51+
3652 internal static NetworkMessageTypes GetMessageTypeEnum ( Type type )
3753 {
3854 if ( type == null || ! s_MessageToMessageType . ContainsKey ( type ) )
You can’t perform that action at this time.
0 commit comments