Interface IInspectionCapability
- Namespace
- KeenEyes.Capabilities
- Assembly
- KeenEyes.Abstractions.dll
Capability interface for entity inspection and debugging.
public interface IInspectionCapability
Examples
public void Install(IPluginContext context)
{
if (context.TryGetCapability<IInspectionCapability>(out var inspector))
{
var name = inspector.GetName(entity);
var components = inspector.GetComponentTypes(entity);
}
}
Remarks
This capability provides access to debugging and inspection APIs that allow examining entity state, component metadata, and entity naming. These features are useful for debugging tools, editors, and runtime introspection.
Plugins that need entity inspection should request this capability via GetCapability<T>() rather than casting to the concrete World type.
Methods
GetName(Entity)
Gets the name assigned to an entity.
string? GetName(Entity entity)
Parameters
entityEntityThe entity to get the name for.
Returns
- string
The entity's name, or null if no name is assigned.
GetRegisteredComponents()
Gets metadata about all registered component types.
IEnumerable<RegisteredComponentInfo> GetRegisteredComponents()
Returns
- IEnumerable<RegisteredComponentInfo>
An enumerable of component metadata.
Remarks
This includes all components that have been registered with the world, whether explicitly or implicitly through entity creation.
HasComponent(Entity, Type)
Checks if an entity has a component of the specified type.
bool HasComponent(Entity entity, Type componentType)
Parameters
Returns
- bool
True if the entity has the component; otherwise, false.
Remarks
This method allows checking for components by runtime Type, useful for debugging and inspection scenarios where the component type isn't known at compile time.