Class PayloadVisibility
Answers "is this spawn payload being written for the character's owner?" for the controllers that filter what non-owners receive.
public static class PayloadVisibility
- Inheritance
-
PayloadVisibility
- Inherited Members
Remarks
FishNet builds the spawn message per receiving connection (ServerObjects.Observers
calls WriteSpawn(nob, writer, conn) inside the per-connection rebuild), so a
behaviour's WritePayload may legitimately vary by receiver. conn.IsValid is
tested first because an unowned NPC's Owner is FishNet's shared EmptyConnection and
a predicted-spawn write passes that same instance as the receiver — without the validity
test those two compare equal and hand the owner-only set to a path that is not the owner.
A null NetworkObject (an unspawned controller, which only tests construct) answers false,
the filtered direction.
Methods
IsOwner(NetworkBehaviour, NetworkConnection)
True when conn owns behaviour's object.
public static bool IsOwner(NetworkBehaviour behaviour, NetworkConnection conn)
Parameters
behaviourNetworkBehaviourconnNetworkConnection