Table of Contents

Interface IBundle

Namespace
KeenEyes
Assembly
KeenEyes.Abstractions.dll

Marker interface for component bundles. Bundles are compositions of multiple components commonly used together.

public interface IBundle

Examples

[Bundle]
public partial struct TransformBundle
{
    public Position Position;
    public Rotation Rotation;
    public Scale Scale;
}

// Generated constructor allows initialization:
var bundle = new TransformBundle(
    new Position { X = 0, Y = 0 },
    new Rotation { Angle = 0 },
    new Scale { X = 1, Y = 1 });

// Generated builder method enables fluent API:
var entity = world.Spawn()
    .WithTransformBundle(position, rotation, scale)
    .Build();

Remarks

Implement this interface on structs to define bundle types. Use the [Bundle] attribute to enable source generation.

Bundles provide a convenient way to add multiple related components to entities at once. All fields in a bundle must be valid component types (structs implementing IComponent).

The source generator will validate bundle definitions and produce: - IBundle interface implementation - Constructor accepting all bundle components - Fluent builder methods for easy entity creation

Use bundles when you frequently add the same set of components together. For one-off entity creation, individual component methods are simpler.

Properties

ComponentTypes

Gets the component types that comprise this bundle.

public static abstract IReadOnlyList<Type> ComponentTypes { get; }

Property Value

IReadOnlyList<Type>

Remarks

This static abstract member is implemented by the source generator and provides AOT-compatible access to bundle component types without reflection. The returned list is read-only so callers cannot mutate the shared backing storage and corrupt bundle metadata process-wide.