Function ambient_api::prelude::ambient_element::use_resource
source · pub fn use_resource<T>(
hooks: &mut Hooks<'_>,
component: Component<T>
) -> (Option<T>, Arc<CbDebuggable<dyn Fn(T) + Sync + Send>>)
Available on crate feature
guest
only.Expand description
Use a resource from the ECS, and update its state if required.
If the resource does not exist, this will return None
.
The setter will add the resource if it does not exist.