World Hook
Docs / Core / World Hook
Hooks provide lifecycle events and interception points for component operations.
Overview
World hooks enable:
- Lifecycle Events: React to world events
- Component Interception: Intercept component operations
- Custom Logic: Add custom behavior
- Validation: Validate component values
API Surface
Write Permission Hook
world.Hooks.AddWritePermission((entity, componentType) =>
{
// Custom permission logic
return HasPermission(entity, componentType);
});
Value Validator
world.Hooks.AddValidator<Health>(health =>
{
// Validate health values
return health.Current >= 0 && health.Current <= health.Max;
});
Examples
See Write Hooks & Validators for detailed examples.
See Also
- Write Hooks & Validators - Detailed guide
- World - World management
- Advanced Topics - Advanced patterns