What's New
This release adds ergonomic API improvements that hide unsafe code from users.
Added
WorldExtextension trait providingentity_ptr()andbind_entity()methods onWorldPartialEq,Eq, andHashimplementations forEntityPtr(compares entity field only)- "Choosing Between Types" documentation section with safety/ergonomics guidance
Changed
- Users no longer need to write
unsafeblocks to createEntityPtr- useworld.entity_ptr(entity)instead
Example
use bevy_ecs::prelude::*;
use bevy_entity_ptr::WorldExt;
fn my_system(world: &World, entity: Entity) {
// No unsafe needed!
let ptr = world.entity_ptr(entity);
if let Some(health) = ptr.get::<Health>() {
println!("Health: {}", health.0);
}
}