Have played with this a lot and really find NetCode to be far behind Mirror and similar options
OnNetworkSpawn() is called before network variables are set, they network variables invoke their on change events as they are being applied … this creates A LOT of issues and difficultly that could easily be corrected
For example we use a pool system and we have a common network behaviour that gets used for a few spawned “actors”
We on spawn set several values such as the actor type, health, etc.
We have found that OnNetworkSpawn for the client the variables are default
We also find that each gets set one by one and invokes its callback so we have no reliable way to know when the state is up to date with some manual logic
What we are going to do is set a bool dirty
when ever any variable updates and then on LateUpdate handle if there are any dirty values … this is a major pain we simply dont have with Mirror and other options
With other options the OnClientStart is called only after the object has been synced for the first time thus you know that all of its inital values set by server are set before this is ran
Next indication of change is only invoked after all variables have been synced that frame thus you know if any is called that all have already been updated for that frame
For example if you have 2 variables A and B and monitor change on each and react to both for each change then in NetCode if A and B are changed in the same update each’s event will be raised but the first raised will be before the second is set
This is again an issue that can be easily solved with better design … we can work around it but its really a shame to see this as Unity’s replacement for uNET when Mirror, FishNet, etc. derived from uNET are so far ahead in so many ways
O ya and we have found issues with NetworkTransform as well … NetCode really seems like its not yet fit for purpose.
We so far are planning to stick with it and work around its issues but it really does not seem to be in a great place.