NetworkIdentity - moved ResetStatics up

This commit is contained in:
MrGadget1024 2023-01-02 12:26:53 -05:00
parent bc28022552
commit 9405e9fef6

View File

@ -244,6 +244,16 @@ internal void HandleRemoteCall(byte componentIndex, ushort functionHash, RemoteC
}
}
// RuntimeInitializeOnLoadMethod -> fast playmode without domain reload
// internal so it can be called from NetworkServer & NetworkClient
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
internal static void ResetStatics()
{
// reset ALL statics
ResetClientStatics();
ResetServerStatics();
}
// reset only client sided statics.
// don't touch server statics when calling StopClient in host mode.
// https://github.com/vis2k/Mirror/issues/2954
@ -258,16 +268,6 @@ internal static void ResetServerStatics()
nextNetworkId = 1;
}
// RuntimeInitializeOnLoadMethod -> fast playmode without domain reload
// internal so it can be called from NetworkServer & NetworkClient
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
internal static void ResetStatics()
{
// reset ALL statics
ResetClientStatics();
ResetServerStatics();
}
/// <summary>Gets the NetworkIdentity from the sceneIds dictionary with the corresponding id</summary>
public static NetworkIdentity GetSceneIdentity(ulong id) => sceneIds[id];