Unity-Technologies / com.unity.multiplayer.docs

Open Source documentation for Unity Multiplayer, which includes Netcode for GameObjects, the Unity Transport Package, Multiplayer Tools and Educational references and Sample Games such as Boss Room.
https://docs-multiplayer.unity3d.com/
Other
643 stars 193 forks source link

NetworkObject DANGER box message is highly confusing #1275

Closed CodeSmile-0000011110110111 closed 1 month ago

CodeSmile-0000011110110111 commented 3 months ago

The NGO 2.0 manual page on NetworkObject has the following DANGER box with confusing statements:

DANGER The order of networked objects matters. Make sure to load any NetworkBehaviour components before the Network Object component on the GameObject.

First sentence: It mentions "networked objects". This might seem to refer to "networked GameObjects" but I think it actually means to say "NetworkBehaviour components" given the context switch to components in the second sentence.

Second sentence: How are we supposed to "load" a NetworkBehaviour or any component for that matter? The concept of "loading" a component does not exist in Unity. You can add a component, or you can change a component's script execution order. If the latter was meant it should say so explicitly, because there is no other option to alter the component execution order. The order of components in the Inspector does not affect the order in which these components run their lifecycle methods.

Lastly, why are we supposed to "load" the NetworkBehaviour components BEFORE the NetworkObject component? Was this meant to say that NetworkObject must be the last component in the script execution order? I feel that would be backwards since it defaults to be at the top.

The DANGER box should also indicate what the expected failures might be (ie error messages, 1-frame delays, RPCs not sent/received) to make troubleshooting easier.

PinoEire commented 2 months ago

This danger box confuses me as well. I know that Unity loads the components from top to bottom (at least that is what it was; now I can't confirm this any longer on the docs). BUT the problem is that if I try to move the NetworkObject to the bottom of the game object, it refuses to do so, which is super confusing. Please clarify.

jabbacakes commented 1 month ago

We've updated the info in this admonition box and turned it into a section on the page called 'Component order' with a lot more detail (see the linked PR). Hopefully that clears things up!

I'm gonna close this issue as completed, but feel free to reopen/leave more comments if the updates don't clear things up.