Function ambient_api_core::entity::mutate_component
source · pub fn mutate_component<T: SupportedValue + Clone + PartialEq>(
entity: EntityId,
component: Component<T>,
mutator: impl FnOnce(&mut T)
) -> Option<T>
Expand description
Mutates the component component
for entity
using the passed in mutator
, and returns its value.
This will not set the component if the value is the same, which will prevent change events from being unnecessarily fired.