Table of Contents

Delegate SystemHook

Namespace
KeenEyes
Assembly
KeenEyes.Abstractions.dll

Represents a callback that is invoked before or after a system executes.

public delegate void SystemHook(ISystem system, float deltaTime)

Parameters

system ISystem

The system being executed.

deltaTime float

The time elapsed since the last update in seconds.

Examples

// Profiling hook
world.AddSystemHook(
    beforeHook: (system, dt) => profiler.BeginSystem(system.GetType().Name),
    afterHook: (system, dt) => profiler.EndSystem()
);

// Logging hook
world.AddSystemHook(
    beforeHook: (system, dt) => logger.Debug($"Starting {system.GetType().Name}"),
    afterHook: (system, dt) => logger.Debug($"Finished {system.GetType().Name}")
);

Remarks

System hooks enable cross-cutting concerns such as profiling, logging, conditional execution, and metrics collection without modifying individual systems. Hooks are registered globally per-world and execute for all systems in that world.

Use World.AddSystemHook to register hooks. Multiple independent hooks can be registered and will execute in registration order.