Method SetComponent
SetComponent<T>(Entity, in T)
Replaces the value of the component on the Entity.
Declaration
public void SetComponent<T>(Entity entity, in T component) where T : unmanaged, IComponentData
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The Entity to set the component to |
T | component | The component to set |
Type Parameters
Name | Description |
---|---|
T | The type of component to set |
Remarks
This method can only be invoked if the same baker instance previously added this specific component. This is not a very common operation in bakers, but sometimes you have utility methods that add the relevant components and initialize them to a reasonable default state for that utility method, but then your baker needs to override the value of one of those added components to something specific in your particular baker.