Skip to content

🎁 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 contract
  • PickupAuthority → resolver and cache
  • PickupAuthorityBinder → 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:

  1. Cached authority
  2. GetComponentInParent<IPickupAuthority>(true)
  3. Scene roots (GetComponentInChildren)
  4. Global scan of active MonoBehaviours
  5. Cache null if 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;
  • true allows all non-null actors
  • false denies all actors

This is intended for:

  • single-player setups
  • prototypes
  • testing scenes

Multiplayer setups should provide their own implementation.


🧪 Diagnostics

TriggerPickup Flow

  1. Resolve authority via PickupAuthority.Resolve(this)
  2. If no authority exists → allow consumption
  3. If authority exists → call HasAuthority(actor)
  4. If false → block consumption
  5. 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.


  • UnityIntegration/TriggerPickup.cs
  • UnityIntegration/InteractablePickupBase.cs
  • Core/PickupEffectRunner.cs