🎁 Pickups — Authority¶
Folder: Runtime/Systems/Pickups/Authority
This folder provides the authority seam used by pickups to decide whether an actor is allowed to consume a pickup.
It is intentionally minimal, optional, and netcode-agnostic.
🎯 Purpose¶
The Authority system provides a pluggable rule for pickup consumption.
It determines whether an actor is allowed to consume a pickup locally.
It does not handle:
- replication
- ownership syncing
- prediction or rollback
- server validation
These concerns belong to your networking solution.
📦 Folder Overview¶
This folder contains:
- a single authority interface (
IPickupAuthority) - a resolver and cache (
PickupAuthority) - a default binder implementation (
PickupAuthorityBinder)
It is a lightweight integration seam, not a full system.
🧩 What Lives Here¶
IPickupAuthority→ authority contractPickupAuthority→ resolver and cachePickupAuthorityBinder→ default implementation
🧠 Usage Guidance¶
Implementing Authority¶
public interface IPickupAuthority
{
bool HasAuthority(GameObject actor);
}
Implement this interface to define your own authority rules.
You can attach implementations to:
- scene roots
- player objects
- server or host objects
- custom gameplay systems
Resolution Model¶
PickupAuthority resolves one usable authority per scene and caches it.
Resolution order:
- Cached authority
GetComponentInParent<IPickupAuthority>(true)- Scene roots (
GetComponentInChildren) - Global scan of active
MonoBehaviours - Cache
nullif none found
Cache is cleared when:
- scenes unload
- active scene changes
- domain reload occurs
Manual invalidation is available if binders change at runtime:
PickupAuthority.Invalidate();
Default Binder¶
PickupAuthorityBinder provides a simple default implementation.
public bool alwaysTrue = true;
trueallows all non-null actorsfalsedenies all actors
This is intended for:
- single-player setups
- prototypes
- testing scenes
Multiplayer setups should provide their own implementation.
🧪 Diagnostics¶
TriggerPickup Flow¶
- Resolve authority via
PickupAuthority.Resolve(this) - If no authority exists → allow consumption
- If authority exists → call
HasAuthority(actor) - If false → block consumption
- If true → apply effect
InteractablePickupBase¶
This base class does not enforce authority automatically.
Authority can be enforced manually:
var auth = PickupAuthority.Resolve(this);
if (auth != null && !auth.HasAuthority(actor))
return false;
⚠️ Important Notes¶
- Authority is optional
- If no binder exists, consumption is allowed
- One binder per scene is recommended
- Authority decisions are local and not network-synchronised
🚫 Not for Production Use¶
This folder does not provide:
- networking or replication
- ownership synchronisation
- server validation systems
It defines a decision seam only.
🔗 Related Documentation¶
- UnityIntegration/TriggerPickup.cs
- UnityIntegration/InteractablePickupBase.cs
- Core/PickupEffectRunner.cs