bevy-migration-0-19-to-0-20
Skill29 starsChanged 12 days agoMITView on GitHub
Use when upgrading from Bevy 0.19 to Bevy 0.20, when `On<Add, T>` or `On<Pointer<Click>>` stops compiling (now `On<Add<T>>` and `On<PointerClick>`), when `ui::Interaction`/`ui::widgets::Button` warn as deprecated (use `ui_widgets::Button` + `Hovered` + `Pressed`), when a `.wgsl` shader with `#import`/`#ifdef` fails to load (WESL), when `iter_many` yields `Result`, when `NextState::set_if_neq` or `Tonemapping::None` behave differently, or when translucent materials stopped refracting (`ScreenSpaceTransmission` is opt-in). Index of every breaking Bevy 0.20 change.
In this repository34 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- bevy-a11ySkill
- bevy-animationSkill
- bevy-assetsSkill
- bevy-audioSkill
- bevy-camerasSkill
- bevy-captureSkill
- bevy-cargo-featuresSkill
- bevy-core-conceptsSkill
- bevy-custom-assetsSkill
- bevy-diagnostics-profilingSkill
- bevy-ecs-componentsSkill
- bevy-ecs-queriesSkill
- bevy-ecs-systemsSkill
- bevy-fluentSkill
- bevy-input-actionsSkill
- bevy-migration-0-17-to-0-18Skill
- bevy-migration-0-18-to-0-19Skill
- bevy-pbr-materialsSkill
- bevy-physicsSkill
- bevy-portingSkill
- bevy-renderingSkill
- bevy-save-loadSkill
- bevySkill
- bevy-testingSkill
- bevy-uiSkill
- bevy-vfxSkill
- bevy-voxel-dataSkill
- bevy-voxel-pipelineSkill
- bevy-voxel-runtimeSkill
- bevy-wasm-webgpuSkill
- similarity-rsSkill
The file
Files
Bevy 0.19 → 0.20 — Migration cheat sheet
Released 2026-10-08 (0.20.0); current patch 0.20.1. Apply top-down. Coming from 0.18? Do
bevy-migration-0-18-to-0-19 first.
When to use this skill
- Compiler errors after a
bevy = "0.19"→bevy = "0.20"bump. - An LLM emits
On<Add, T>,Pointer<Click>,Interaction::Pressed,set_if_neq, or naga_oil#importlines. - Transparent or translucent scenes render differently after the bump.
IntoObserverSystemerrors mention "one too many generics".
The breaks you'll hit first
use bevy::core_pipeline::tonemapping::Tonemapping;
use bevy::mesh::MeshTag;
use bevy::picking::hover::Hovered;
use bevy::prelude::*;
use bevy::ui::Pressed;
use bevy::ui_widgets::Button;
// 1. Lifecycle observers carry the bundle on the event, not on `On`.
fn on_player_added(add: On<Add<Player>>, mut commands: Commands) {
commands.entity(add.entity).insert(Name::new(format!("player-{}", add.entity)));
}
// Dynamic components: `On<Add>` → `On<Add<()>>`.
// 2. Pointer events are flat. Fields moved onto `.pointer`.
fn on_click(click: On<PointerClick>) {
info!("clicked {} at {:?}", click.entity, click.pointer.position);
}
// 3. `ui::Interaction` and `ui::widgets::Button` are deprecated. `Pressed` is a marker.
fn style_button(mut buttons: Query<(&Hovered, Has<Pressed>, &mut BackgroundColor), With<Button>>) {
for (hovered, pressed, mut bg) in &mut buttons {
bg.0 = match (pressed, hovered.get()) {
(true, _) => Color::srgb(0.1, 0.1, 0.1),
(false, true) => Color::srgb(0.3, 0.3, 0.3),
_ => Color::srgb(0.2, 0.2, 0.2),
};
}
}
// 4. `iter_many` family yields `Result`; `.matched()` restores skip-missing behaviour.
fn visit(targets: Res<Targets>, names: Query<&Name>) {
for name in names.iter_many(targets.0.iter()).matched() {
info!("{name}");
}
}
// 5. `set_if_neq` → `set_if_different` (old name is a deprecated wrapper).
fn go_play(mut next: ResMut<NextState<Phase>>) {
next.set_if_different(Phase::Play);
}
// 6. `&mut World` is a normal `SystemParam`; it may sit anywhere in the signature.
fn world_anywhere(mut counter: Local<u32>, world: &mut World) {
*counter += 1;
world.spawn((Mesh3d::default(), MeshTag::new(7))); // MeshTag(7) → MeshTag::new(7)
}Player, Targets, Phase are ordinary Component/Resource/States types.
Rendering
// Camera3d no longer requires ScreenSpaceTransmission. Add it back for refraction.
commands.spawn((
Camera3d::default(),
bevy::pbr::ScreenSpaceTransmission::default(),
Tonemapping::Linear, // "no tone curve" — `Tonemapping::None` is now a raw passthrough
));Tonemapping::NoneskipsColorGrading,DebandDither, and the negative clamp. UseLinearfor the old "no curve" look.Camera2dnow defaults toLinear.TonemappingandDebandDitherlive inbevy_render::view(reflect paths changed; Rust imports still work).- WESL shaders. naga_oil is gone.
.wgsl+#import/#ifdef/#define_import_path→.wesl+import bevy_pbr::render::forward_io::VertexOutput;+@if(DEF). Plain WGSL without preprocessor lines still loads. GLSL removed.shader_format_weslfeature removed. Module paths follow crate file paths (bevy_pbr::mesh_view_bindings→bevy_pbr::render::mesh_view_bindings). Full table: references/wesl-shaders.md. UnpreparedBindGroup→BindGroupBuilder;AsBindGroup::unprepared_bind_group→build_bind_group.#[derive(AsBindGroup)]users: no change.- Extraction is generic over worlds:
#[derive(ExtractComponent)] #[extract_app(RenderApp)],impl SyncComponent<RenderApp>; newbevy_extractcrate. Spriterenders throughMesh2d+SpriteMeshMaterialand gainedalpha_mode. Overlapping sprites at equal Z may reorder; give them explicit Z.- OIT is per-material (
Material::enable_oit, shader defMATERIAL_OIT_ENABLED);oit_drawwants premultiplied color. MeshAabb::compute_aabb→get_aabb.WgpuWrapperremoved.ViewDepthTexture→ViewDepthStencilTexture.AtmosphereBufferis a per-camera component.RenderDebugOverlayPluginjoinsDefaultPluginswhen thebevy_dev_tools+render_dev_toolsfeatures (thedevcollection) are on; enable keys viabevy::dev_tools::render_debug::RenderDebugOverlayKeybindings.
ECS and scheduling
On<E, B>lostB;IntoObserverSystem<E: EventPattern, M, Out>has three generics. Custom bundle-generic events implementEventPattern.- Exclusive systems unified:
ExclusiveSystemParam,ExclusiveFunctionSystem,System::is_exclusive,ExclusiveMarkerremoved. Exclusivity is tracked at runtime viaSystemAccess.WorldIdin an exclusive system →Local<WorldId>orworld.id(). - Built-in schedules (
Render,RenderGraph,Core2d/Core3d,ExtractSchedule, UI sets inPostUpdate) use.chain_weak(). Only tracked data conflicts are ordered. If you relied on a channel, atomic, or interior mutability across sets, add an explicit.after(...). FilteredResources*deprecated →QueryParamBuilder+Query<FilteredEntityRef>with.with::<IsResource>().Name: From<&'static str>only; useName::new(s.to_owned())for runtime strings.WorldQuerymanual impls must add emptyinit_nested_accessandupdate_archetypes.DeferredWorld::querydeprecated →query_state.query_mut(&mut world).ComponentInfo::id()removed.ComponentIdlifecycle constants are typed.define_label!takes no interner argument.ScheduleBuildSettings.shuffle_seedexists under thedebugfeature.Access::reads_and_writes→reads.TypeIdMapdeprecated →TypeIdHashMap/TypeIdIndexMap.
UI and text
TextFont::default().font_sizeisFontSize::Rem(1.)(wasPx(20.)); setPxexplicitly for fixed sizes.FontSource::SansSerifetc →FontSource::sans_serif()/GenericFontFamily.resolve_font_source→text_font.font.resolve_font_family(fonts).Font::from_bytesno longer takes a family name.- New
Val::Em/Val::Remwithem()/rem()helpers;NoderequiresEmSize;Val::resolvetakesem_size, rem_size;FontSize::evaltakesRemSize. BorderRadiusis aNodefield (Node { border_radius: BorderRadius::all(CornerRadius::circular(px(8.))), .. }), not a component. Its fields areCornerRadius(.into()fromValworks); constructors are no longerconst.EditableText+TextInputare separate components.TextScroll→EditableText::viewport. Escape blurs the field and now bubbles.CalculatedClipis an enum (Rects/FullyClipped).TextReader::getreturnsTextLayoutItem.FocusCause::Autoadded. UI rendering is retained (ExtractedUiNodes::changed).- Feathers:
cursormodule moved tobevy_picking::cursor(and thecustom_cursorfeature with it);FeathersNumberInputtakes aNumberInputValuecomponent; contextual theming reorganisedThemeProps.
Assets, math, reflection, features
AssetId::invalid()deprecated →Option<AssetId>.UntypedHandle::meta_transformremoved.AssetLoadError::RequestedHandleTypeMismatchis boxed.compressed_image_savernow emits BCn/ASTC; old UASTC behaviour iscompressed_image_saver_universal. JPEG joined the default processor list.bevy_curveandbevy_shapesplit frombevy_math(bevy_math/curvefeature gone; enablebevy/bevy_curve). Prelude unchanged; directbevy_math::primitives::*imports move tobevy_shape.FromType<T>→CreateTypeData<T>;PartialReflect::to_dynamicreturnsResult;ReflectFromPtr::from_ptr*→raw_pointer_cast;as_reflect→ptr_as_reflect.- BSN:
@prefix on scene references,--between entities,template_valuegone. references/bsn-syntax.md. LinearRgba::with_luminanceno longer clamps. macOS activation followsWindow::focused.
Gotchas
- Deprecated, not removed:
Interaction,ui::widgets::Button,set_if_neq,FilteredResources,TypeIdMap,AssetId::invalid(). Builds pass with warnings; fix them before 0.21. - Silent render change: missing
ScreenSpaceTransmissionmakes glass opaque-looking. No error. - Silent ordering change:
chain_weakonly reorders systems with no tracked conflict. Bugs surface as flaky frames, not panics. - Shader errors at runtime: a naga_oil
.wgslfails at asset load, not atcargo check. Rename to.wesland convert directives. - rustc floor: Bevy 0.20.1 requires rustc 1.97.1 (
weslcrates).
See also
bevy-migration-0-18-to-0-19— the previous release's catalogue; apply it first.bevy-ecs-components— observers and lifecycle events in their 0.20 form.bevy-ui—Button+Hovered+Pressed,FontSize::Rem,CornerRadius.bevy-pbr-materials— WESL custom materials andScreenSpaceTransmission.bevy-cargo-features—bevy_curve,bevy_shape,compressed_image_saver*,custom_cursor.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

