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
IHealthAuthorityimplementations - Cache resolved authority per scene
- Keep
HealthSystemfree 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:
- Scene cache
- Local
IHealthAuthorityon the context object - Parent hierarchy
- Same-scene roots
- Global scan (last resort)
Notes:
- Used when
requireAuthorityis enabled and no injected resolver is present - Every step matches the
IHealthAuthorityinterface. Before 1.3.0 every step matched the concreteHealthAuthorityBindercomponent, 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
Behaviourmust be enabled and in an active hierarchy; a non-Behaviourimplementation only has to be non-null, and a destroyedUnityEngine.Objectis 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:
HealthAuthorityCacheand bothInvalidateoverloads 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 andHealthSystemre-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, andHealthSystem.SetAuthorityResolveris 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
IHealthAuthorityorSetAuthorityResolverusing internal helpers
For authority integration, use:
IHealthAuthorityHealthAuthorityBinderHealthSystem.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
Related Documentation¶
- Health Authority
- Health Abstractions
- Health System