bevy/release-content/migration-guides
Eagster 064e5e48b4
Remove entity placeholder from observers (#19440)
# Objective

`Entity::PLACEHOLDER` acts as a magic number that will *probably* never
really exist, but it certainly could. And, `Entity` has a niche, so the
only reason to use `PLACEHOLDER` is as an alternative to `MaybeUninit`
that trades safety risks for logic risks.

As a result, bevy has generally advised against using `PLACEHOLDER`, but
we still use if for a lot internally. This pr starts removing internal
uses of it, starting from observers.

## Solution

Change all trigger target related types from `Entity` to
`Option<Entity>`

Small migration guide to come.

## Testing

CI

## Future Work

This turned a lot of code from 

```rust
trigger.target()
```

to 

```rust
trigger.target().unwrap()
```

The extra panic is no worse than before; it's just earlier than
panicking after passing the placeholder to something else.

But this is kinda annoying. 

I would like to add a `TriggerMode` or something to `Event` that would
restrict what kinds of targets can be used for that event. Many events
like `Removed` etc, are always triggered with a target. We can make
those have a way to assume Some, etc. But I wanted to save that for a
future pr.
2025-06-09 19:37:56 +00:00
..
.gitkeep
anchor_is_removed_from_sprite.md Fix Anchor component inconsistancies (#18393) 2025-05-21 15:32:04 +00:00
camera_restructure.md Split Camera.hdr out into a new component (#18873) 2025-05-26 19:24:45 +00:00
dragenter_includes_dragged_entity.md don't filter dragged entity out of DragEnter events (#19179) 2025-05-26 17:56:54 +00:00
entities_apis.md Remove invalid entity locations (#19433) 2025-05-31 16:34:33 +00:00
entity_representation.md Nonmax all rows (#19132) 2025-05-26 17:39:55 +00:00
generic-option-parameter.md Generic SystemParam impls for Option and Result (#18766) 2025-05-07 18:20:08 +00:00
interned-labels-cleanup.md Remove upcasting methods + Cleanup interned label code (#18984) 2025-05-26 15:38:12 +00:00
labeled_asset_scope_errors.md Allow returning an error from labeled_asset_scope. (#19449) 2025-06-04 00:00:32 +00:00
log-diagnostics-hash-set.md Expose LogDiagnosticsState (#19323) 2025-05-23 20:56:36 +00:00
merge_observerState_observer_single_component.md Merge ObserverState and Observer into single component (#18728) 2025-05-06 00:12:27 +00:00
observer_triggers.md Remove entity placeholder from observers (#19440) 2025-06-09 19:37:56 +00:00
observers_may_not_be_exclusive.md Prevent exclusive systems from being used as observers (#19033) 2025-05-05 17:46:25 +00:00
overflowclipbox_default_is_now_paddingbox.md
per-world-error-handler.md Per world error handler (#18810) 2025-05-19 01:35:07 +00:00
picking_location_not_component.md fix(picking): Location is not a Component anymore. (#19306) 2025-05-22 01:33:01 +00:00
relative_cursor_position_is_object_centered.md Specialized UI transform (#16615) 2025-06-09 19:05:49 +00:00
remove_archetype_component_id.md Remove ArchetypeComponentId and archetype_component_access (#19143) 2025-05-27 19:04:32 +00:00
remove_archetypecomponentid.md Stop using ArchetypeComponentId in the executor (#16885) 2025-05-05 22:52:44 +00:00
remove_cosmic_text_reexports.md Remove re-exports of cosmic_text types (#19516) 2025-06-06 21:49:02 +00:00
remove_deprecated_batch_spawning.md Remove insert_or_spawn function family (#18148) 2025-05-05 23:14:32 +00:00
remove_the_add_sub_impls_on_volume.md fix: Ensure linear volume subtraction does not go below zero (#19423) 2025-06-05 03:59:20 +00:00
rename_condition.md Rename Condition to SystemCondition` (#19328) 2025-05-22 15:50:19 +00:00
rename_spawn_gltf_material_name.md Add GltfMeshName component and Deref implementations (#19331) 2025-05-23 20:56:48 +00:00
rename_state_scoped.md Refactor state scoped events to match entities. (#19435) 2025-05-31 20:14:14 +00:00
rename_timer_paused_and_finished.md Rename Timer::finished and Timer::paused to is_finished and is_paused (#19386) 2025-05-27 22:24:18 +00:00
scalar-field-on-vector-space.md Improve Bevy's double-precision story for third-party crates (#19194) 2025-06-08 02:02:47 +00:00
separate-border-colors.md separate border colors (#18682) 2025-05-26 16:57:13 +00:00
simple_executor_going_away.md deprecate SimpleExecutor (#18753) 2025-05-06 00:21:57 +00:00
specialized_ui_transform.md Specialized UI transform (#16615) 2025-06-09 19:05:49 +00:00
state_scoped_entities_by_default.md Enable state scoped entities by default (#19354) 2025-05-26 20:26:41 +00:00
sync_cell_utils.md refactor(utils): move SyncCell and SyncUnsafeCell to bevy_platform (#19305) 2025-05-27 04:57:26 +00:00
system_set_naming_convention.md Adopt consistent FooSystems naming convention for system sets (#18900) 2025-05-06 15:18:03 +00:00
taa_non_experimental.md Make TAA non-experimental, fixes (#18349) 2025-06-02 16:04:08 +00:00
unified_system_state_flag.md Unify system state (#19506) 2025-06-08 18:18:43 +00:00