Skip to content

🧭 Health Authority

📦 Folder Overview

This folder defines how mutation permission is determined for Health.


🎯 Purpose

Authority acts as a gate for mutation.

It answers one question:

Is this caller allowed to mutate this health instance?


🧩 What Lives Here

Core Contract — IHealthAuthority

bool HasAuthority(IHealthReadonly health);

Semantics:

  • Returns true → mutation is allowed
  • Returns false → mutation is denied

No side effects. No state changes.


⚠️ Important Notes

Authority does not:

  • Replicate state
  • Synchronize health
  • Define ownership
  • Handle networking
  • Guarantee consistency across machines

These concerns belong to your networking layer, not Health.


🧠 Usage Guidance

How It Is Used

  • HealthSystem consults authority only when requireAuthority is enabled
  • If no authority is resolved → mutation is denied
  • If authority returns false → mutation is denied

Authority is enforced at the point of mutation, not continuously.


⚠️ Important Notes

Design Constraints

Implementations are expected to be:

  • Fast enough for hot paths
  • Designed to avoid allocations
  • Side-effect free (pure query only)

⚠️ Important Notes

Boundaries

Do not:

  • Encode networking or replication logic here
  • Couple authority to a specific framework (Mirror, NGO, Photon, etc.)
  • Assume scene-based resolution or Unity-specific lookup
  • Perform mutation inside authority checks

Authority is a permission layer, nothing more.


  • Health Abstractions
  • Health System