Vixen
dd8b0a81
csharp
public struct NetworkObject

Marks a node of a prefab or a scene as one the network should give an id to.

Read the guide page for this →

As a scene component

Size
1 bytes — 1260 rows in a 16 KB chunk, alone on the archetype

Remarks

The authored half of NetworkId, and the two are deliberately different components. A NetworkId is a number the server allocated — a handle, which only exists once a session does. This is a designer's claim about content: this entity is a thing the network addresses, made before any peer has connected and true in every process that loads the asset. One is runtime state and one is authored fact, and a component that tried to be both would have to be written into a scene file to be authorable — which would let a designer, or a play-mode save, put a number in content that no server ever handed out.

⚠ [Component] and [DataContract], which is the whole point of it. What a compiled scene may name is a component carrying both (SceneComponentRegistry), and NetworkId carries only the first — which it cannot fix, because Vixen.Net may not reference Vixen.Engine and so runs neither generator. So the marker lives in the assembly that already sees both, beside PlayerPawn, which is an authored fact about a prefab for the same reason.

A tag, so it costs a bit in an archetype mask and not a byte of chunk memory. There is nothing to say beyond the marking: which id the node ends up with is decided by the thing that instantiates it — NetworkIdAllocator for a spawn, BakedId for an object a scene placed.

Used by (8)

  • ComponentRegistrationVixen.Net.Engine
  • NetworkDisconnectTestsVixen.Net.Engine.Tests
  • NetworkPrefabContentTestsVixen.Net.Engine.Content.Tests
  • NetworkPrefabRegistryVixen.Net.Engine
  • NetworkRulesReferenceTestsVixen.Net.Engine.Tests
  • TypeRegistrationVixen.Net.Engine
  • Vixen_Net_Engine_NetworkObjectSerializerVixen.Net.Engine
  • SceneNetworkComponentTestsVixen.Editor.Assets.Tests