Struct bevy_ecs::system::EntityCommands [−][src]
Implementations
impl<'a, 'b> EntityCommands<'a, 'b>
[src]
pub fn id(&self) -> Entity
[src]
Retrieves the current entity’s unique Entity id.
pub fn insert_bundle(&mut self, bundle: impl Bundle) -> &mut Self
[src]
Adds a bundle of components to the current entity.
See [Self::with
], [Self::current_entity
].
pub fn insert(&mut self, component: impl Component) -> &mut Self
[src]
Adds a single component to the current entity.
See Self::insert_bundle
, Self::id
.
Warning
It’s possible to call this with a bundle, but this is likely not intended and
Self::insert_bundle
should be used instead. If with
is called with a bundle, the bundle
itself will be added as a component instead of the bundles’ inner components each being
added.
Example
Self::insert
can be chained with [Self::spawn
].
use bevy_ecs::prelude::*; struct Component1; struct Component2; fn example_system(mut commands: Commands) { // Create a new entity with `Component1` and `Component2` commands.spawn() .insert(Component1) .insert(Component2); // Psst! These are also equivalent to the expression above! commands.spawn().insert_bundle((Component1, Component2)); commands.spawn_bundle((Component1, Component2)); }
pub fn remove_bundle<T>(&mut self) -> &mut Self where
T: Bundle,
[src]
T: Bundle,
pub fn remove<T>(&mut self) -> &mut Self where
T: Component,
[src]
T: Component,
pub fn despawn(&mut self)
[src]
Despawns only the specified entity, not including its children.
pub fn commands(&mut self) -> &mut Commands<'a>
[src]
Auto Trait Implementations
impl<'a, 'b> !RefUnwindSafe for EntityCommands<'a, 'b>
impl<'a, 'b> Send for EntityCommands<'a, 'b>
impl<'a, 'b> Sync for EntityCommands<'a, 'b>
impl<'a, 'b> Unpin for EntityCommands<'a, 'b> where
'a: 'b,
'a: 'b,
impl<'a, 'b> !UnwindSafe for EntityCommands<'a, 'b>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Component for T where
T: 'static + Send + Sync,
[src]
T: 'static + Send + Sync,
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
[src]
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Any + Send + Sync,
[src]
T: Any + Send + Sync,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,