[−][src]Struct bevy_ecs::EntityBuilder
Helper for incrementally constructing a bundle of components with dynamic component types
Prefer reusing the same builder over creating new ones repeatedly.
let mut world = World::new(); let mut builder = EntityBuilder::new(); builder.add(123).add("abc"); let e = world.spawn(builder.build()); // builder can now be reused assert_eq!(*world.get::<i32>(e).unwrap(), 123); assert_eq!(*world.get::<&str>(e).unwrap(), "abc");
Implementations
impl EntityBuilder
[src]
pub fn new() -> EntityBuilder
[src]
Create a builder representing an entity with no components
pub fn add<T>(&mut self, component: T) -> &mut EntityBuilder where
T: Component,
[src]
T: Component,
Add component
to the entity
pub fn build(&mut self) -> BuiltEntity
[src]
Construct a Bundle
suitable for spawning
pub fn clear(&mut self)
[src]
Drop previously add
ed components
The builder is cleared implicitly when an entity is built, so this doesn't usually need to be called.
Trait Implementations
impl Default for EntityBuilder
[src]
fn default() -> EntityBuilder
[src]
impl Drop for EntityBuilder
[src]
impl Send for EntityBuilder
[src]
impl Sync for EntityBuilder
[src]
Auto Trait Implementations
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,
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> From<T> for T
[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.
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.
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>,