public record class NetworkRulesWho is allowed to do what to a networked object.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The best idea in the design this one is derived from, and the reason it is a declaration rather than a switch: a co-operative game and a competitive shooter want different answers to every question below, and without this they get them by being different engines. With it they are the same engine with different rules, and relaxing server authority is an explicit, reviewable decision somebody wrote down rather than an accident somebody made.
Rules never grant a client more than the code asks for. Where both a rule and an attribute have an opinion — an [ServerRpc(RequireOwnership = true)] on an object whose rules say Everyone — the stricter of the two wins. A policy file cannot quietly widen what a method declared about itself; it can only narrow it.
What is enforced today. CallServerRpc is checked by RpcRouter before a call is dispatched, ChangeOwner by the ownership transfer path, and OnOwnerDisconnect when a player leaves. Spawn, Despawn and Write are declared and answered through NetworkRulesRegistry, and have no enforcement point yet because nothing can spawn a networked object from a client or write replicated state from one — when those arrive they ask the same question rather than inventing a second policy.
Fields and properties (9)
public static NetworkRules ServerAuthoritativeEverything the server's, which is what a competitive game wants.
public static NetworkRules OwnerAuthoritativeThe owner may act on what is theirs: call, move, and hand it on. What a co-operative game or a trusted-client prototype wants, and a deliberate relaxation rather than a default.
public RuleAudience SpawnWho may ask the server to create one of these.
public RuleAudience DespawnWho may ask the server to destroy one.
public RuleAudience CallServerRpcWho the rules allow to invoke a server call on one.
public RuleAudience WriteWho may write the replicated state of one.
public RuleAudience ChangeOwnerWho may hand one to somebody else.
public OwnershipClaim ClaimWhen they may, which is a different question from who.
public DisconnectBehaviour OnOwnerDisconnectWhat becomes of one when the player who owned it goes.
Methods (1)
public static bool Allows(RuleAudience audience, PlayerId requester, bool isOwner)Whether an audience admits a particular client.
Used by (15)
- NetworkAnimatorApplySystemVixen.Net.Animation
- NetworkAnimatorCaptureSystemVixen.Net.Animation
- NetworkAnimatorTestsVixen.Net.Animation.Tests
- NetworkAudioApplySystemVixen.Net.Audio
- NetworkAudioCaptureSystemVixen.Net.Audio
- NetworkAudioTestsVixen.Net.Audio.Tests
- NetworkBonesApplySystemVixen.Net.Animation
- NetworkBonesCaptureSystemVixen.Net.Animation
- NetworkRigidBodyCaptureSystemVixen.Net.Physics
- NetworkRigidBodyCorrectionSystemVixen.Net.Physics
- NetworkRigidBodyTestsVixen.Net.Physics.Tests
- NetworkRulesRegistryVixen.Net
- NetworkRulesTestsVixen.Net.Tests
- NetworkSpawnerVixen.Net.Engine
- PredictionWiringTestsVixen.Net.Tests