I’m coming from this question at Unity Answers: What calls UNetStaticUpdate in NetworkIdentity? - Questions & Answers - Unity Discussions
Trying to dissect NetworkIdentity, I found this issue:
A NetworkIdentity component (and there are lots of them in a multiplayer scene) has this method:
// this is invoked by the UnityEngine
static internal void UNetStaticUpdate()
{
NetworkServer.Update();
NetworkClient.UpdateClients();
NetworkManager.UpdateScene();
#if UNITY_EDITOR
NetworkDetailStats.NewProfilerTick(Time.time);
#endif
}
NetworkServer (which is an instance) .Update() calls s_Instance.InternalUpdate();
InternalUpdate() calls UpdateServerObjects().
And UpdateServerObjects() calls, for each NetworkIdentity, UNetUpdate();
So, if I get this right… let’s say 10 NetworkIdentity components exist in my scene. Each of them calls NetworkServer.Update(). So that Update function is executed 10 times. So, eventually, NetworkIdentity.UNetUpdate() is executed 10 times on each NetworkIdentity, 100 times as a whole.
Or is UNetStaticUpdate() only called once, independent from the numbers of components?
I tried to reimplement the NetworkIdentity component, but UNetStaticUpdate is never called, so I’m not sure how that works at all.