Interface IWorldPlugin
- Namespace
- KeenEyes
- Assembly
- KeenEyes.Abstractions.dll
Interface for world plugins that provide modular functionality to an ECS world.
public interface IWorldPlugin
Examples
public class PhysicsPlugin : IWorldPlugin
{
public string Name => "Physics";
public void Install(IPluginContext context)
{
// Register physics systems
context.AddSystem<BroadphaseSystem>(SystemPhase.FixedUpdate, order: 0);
context.AddSystem<NarrowphaseSystem>(SystemPhase.FixedUpdate, order: 10);
context.AddSystem<SolverSystem>(SystemPhase.FixedUpdate, order: 20);
// Expose physics API
context.SetExtension(new PhysicsWorld());
}
public void Uninstall(IPluginContext context)
{
// Cleanup is handled automatically
}
}
Remarks
Plugins encapsulate related systems, components, and functionality that can be installed into a world. This enables modular architecture where features like physics, rendering, or networking can be added independently.
Plugins are installed per-world, maintaining the isolation principle where each world has its own independent state. A plugin can be installed on multiple worlds simultaneously if it maintains no shared mutable state.
Properties
Name
Gets the unique name of this plugin.
string Name { get; }
Property Value
Remarks
The name should be unique within a world. Installing a plugin with the same name as an already-installed plugin will throw an exception.
Methods
Install(IPluginContext)
Called when the plugin is installed into a world.
void Install(IPluginContext context)
Parameters
contextIPluginContextThe plugin context providing access to system registration and extension APIs.
Remarks
Use this method to register systems, set up extensions, and perform any initialization the plugin requires. Systems registered through the context are tracked and will be automatically cleaned up on uninstall.
Uninstall(IPluginContext)
Called when the plugin is uninstalled from a world.
void Uninstall(IPluginContext context)
Parameters
contextIPluginContextThe plugin context providing access to cleanup operations.
Remarks
Use this method to perform any custom cleanup beyond what is automatically handled. Systems registered during installation are automatically removed and disposed.