Function ambient_api::prelude::entity::mutate_component
source · pub fn mutate_component<T>(
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.