Skip to content

Health — Internal / Authority

Folder Overview

This folder contains internal authority-resolution helpers used by the Health system.

These types support authority lookup and cache invalidation, but they are not public extension seams.


Purpose

Internal authority helpers exist to:

  • Resolve component-based IHealthAuthority implementations
  • Cache resolved authority per scene
  • Keep HealthSystem free from direct resolution plumbing

What Lives Here

This folder contains:

  • Internal lookup and caching support
  • Runtime plumbing for authority resolution

It does not contain:

  • Public authority contracts
  • Supported extension points
  • Networking systems

Components

HealthAuthority

Internal resolver for IHealthAuthority.

Responsibilities:

  • Resolves authority using a context object
  • Caches resolved authority per scene
  • Searches using a fixed precedence
  • Returns only active, enabled authorities for runtime use

Resolution model:

  1. Scene cache
  2. Local IHealthAuthority on the context object
  3. Parent hierarchy
  4. Same-scene roots
  5. Global scan (last resort)

Notes:

  • Used when requireAuthority is enabled and no injected resolver is present
  • Every step matches the IHealthAuthority interface. Before 1.3.0 every step matched the concrete HealthAuthorityBinder component, which left the public interface with no reachable caller; the five sibling resolvers had always matched the interface
  • Inactive authorities may be discovered for diagnostics but are not used as active authority. A Behaviour must be enabled and in an active hierarchy; a non-Behaviour implementation only has to be non-null, and a destroyed UnityEngine.Object is rejected by Unity's own null semantics rather than by a reference comparison
  • Cache entries are invalidated when local binders enable or disable. Nothing else has to be called, and nothing else can be: HealthAuthorityCache and both Invalidate overloads are internal. An authority that leaves — disabled or destroyed, shipped binder or custom implementation — stops answering on the next mutation, because the cache validates on read and HealthSystem re-tests the instance its own resolver closes over. An authority that appears is found by the next mutation on any component that has not resolved one; displacing a live one is what the shipped binder's enable hook does for you, and HealthSystem.SetAuthorityResolver is the public route when a custom implementation has to

This is an internal resolver, not an abstraction.


HealthAuthorityCache

Internal gateway for invalidating cached authority state.

Purpose:

  • Avoids exposing resolver implementation details
  • Centralises scene and global invalidation

Behaviour:

  • Invalidates one scene cache entry
  • Or invalidates all cached entries

Important Notes

Boundaries

Do not:

  • Depend on these types from gameplay code
  • Build networking logic on top of them
  • Treat them as supported extension points
  • Bypass IHealthAuthority or SetAuthorityResolver using internal helpers

For authority integration, use:

  • IHealthAuthority
  • HealthAuthorityBinder
  • HealthSystem.SetAuthorityResolver(...)

Usage Guidance

  • Treat this folder as implementation detail
  • Prefer public contracts and injection seams for all integrations
  • Expect internal lookup behaviour to change over time

Not for Production Use

This folder is not intended as a gameplay integration surface


  • Health Authority
  • Health Abstractions
  • Health System