mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
feat: Expose NetworkEarlyUpdate/NetworkLateUpdate (see #2826)
This commit is contained in:
parent
966af93e50
commit
ff34a50fdf
@ -45,6 +45,10 @@ internal static class NetworkLoop
|
|||||||
// helper enum to add loop to begin/end of subSystemList
|
// helper enum to add loop to begin/end of subSystemList
|
||||||
internal enum AddMode { Beginning, End }
|
internal enum AddMode { Beginning, End }
|
||||||
|
|
||||||
|
// callbacks in case someone needs to use early/lateupdate too.
|
||||||
|
public static Action OnEarlyUpdate;
|
||||||
|
public static Action OnLateUpdate;
|
||||||
|
|
||||||
// helper function to find an update function's index in a player loop
|
// helper function to find an update function's index in a player loop
|
||||||
// type. this is used for testing to guarantee our functions are added
|
// type. this is used for testing to guarantee our functions are added
|
||||||
// at the beginning/end properly.
|
// at the beginning/end properly.
|
||||||
@ -180,11 +184,15 @@ static void NetworkEarlyUpdate()
|
|||||||
//Debug.Log("NetworkEarlyUpdate @ " + Time.time);
|
//Debug.Log("NetworkEarlyUpdate @ " + Time.time);
|
||||||
NetworkServer.NetworkEarlyUpdate();
|
NetworkServer.NetworkEarlyUpdate();
|
||||||
NetworkClient.NetworkEarlyUpdate();
|
NetworkClient.NetworkEarlyUpdate();
|
||||||
|
// invoke event after mirror has done it's early updating.
|
||||||
|
OnEarlyUpdate?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NetworkLateUpdate()
|
static void NetworkLateUpdate()
|
||||||
{
|
{
|
||||||
//Debug.Log("NetworkLateUpdate @ " + Time.time);
|
//Debug.Log("NetworkLateUpdate @ " + Time.time);
|
||||||
|
// invoke event before mirror does its final late updating.
|
||||||
|
OnLateUpdate?.Invoke();
|
||||||
NetworkServer.NetworkLateUpdate();
|
NetworkServer.NetworkLateUpdate();
|
||||||
NetworkClient.NetworkLateUpdate();
|
NetworkClient.NetworkLateUpdate();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user