createFacadeWithoutInit<T> method

T createFacadeWithoutInit<T>(
  1. ComponentId componentId,
  2. int index
)

Create facade without initializing the column.

Assumes the column has just been initialized via initializeColumn, with no intervening facade access or query that changes its binding. Use this in hot paths after initialization to avoid redundant static field writes.

componentId - The ID of the component to create a facade for. index - The index of the entity in the column.

Implementation

T createFacadeWithoutInit<T>(final ComponentId componentId, final int index) {
  if (!componentId.isValid) {
    throw ArgumentError('Invalid ComponentId: $componentId');
  }
  final factory = _factories[componentId.value];
  if (factory == null) {
    throw EcsStateError(
      'No facade factory for component $componentId. '
      'Factory must be registered or initialized before calling createFacadeWithoutInit.',
    );
  }
  return factory.create(index) as T;
}