Function insert_by_id

Source
pub unsafe fn insert_by_id<T: Send + 'static>(
    component_id: ComponentId,
    value: T,
    mode: InsertMode,
) -> impl EntityCommand
Expand description

An EntityCommand that adds a dynamic component to an entity.

ยงSafety

  • ComponentId must be from the same world as the target entity.
  • T must have the same layout as the one passed during component_id creation.