-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed as duplicate of#18980
Closed as duplicate of#18980
Copy link
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorP-CrashA sudden unexpected crashA sudden unexpected crashS-Needs-InvestigationThis issue requires detective work to figure out what's going wrongThis issue requires detective work to figure out what's going wrong
Description
Bevy version and features
0.17.0-rc.2
[Optional] Relevant system information
2025-09-30T00:47:58.160894Z INFO plugin build{plugin="bevy_diagnostic::DiagnosticsPlugin"}: bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux (NixOS 25.05)", kernel: "6.12.34", cpu: "Intel(R) Core(TM) i7-14700KF", core_count: "20", memory: "31.2 GiB" }
2025-09-30T00:47:58.413688Z INFO plugin build{plugin="bevy_render::RenderPlugin"}: bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 4060 Ti", vendor: 4318, device: 10243, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "570.153.02", backend: Vulkan }
What you did
I am loading some files from an old game and they use negative scale on meshes to mirror them. I made a change to only add MeshMaterial3d after TransformSystems::Propagate to be able to query the GlobalTransform for the updated scale. This is needed because i need to set some shader defs if the scale is negative on 1 or 3 axis.
What went wrong
Some times the program runs, some times it doesn't with
0: bevy_ecs::system::function_system::system
with name="bevy_pbr::material::specialize_material_meshes"
at /home/hukasu/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_ecs-0.17.0-rc.2/src/system/function_system.rs:49
thread 'main' panicked at /home/hukasu/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_pbr-0.17.0-rc.2/src/material.rs:973:79:
called `Option::unwrap()` on a `None` value
Additional information
I imagine that there is a system set that i need to have my system run before for it to work consistently. Here is my code
app.add_systems(
PostUpdate,
invert_material.after(TransformSystems::Propagate),
);
fn invert_material(
mut commands: Commands,
rsms: Populated<
(NameOrEntity, &RsmMaterials, &GlobalTransform),
(With<Mesh3d>, Without<MeshMaterial3d<RsmMaterial>>),
>,
) {
for (rsm, rsm_materials, global_transform) in rsms.into_inner() {
let inverted_axis = global_transform.scale().is_negative_bitmask().count_ones();
let material = if inverted_axis % 2 == 0 {
rsm_materials.base.clone()
} else {
rsm_materials.inverted.clone()
};
commands.entity(rsm.entity).insert(MeshMaterial3d(material));
}
}Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorP-CrashA sudden unexpected crashA sudden unexpected crashS-Needs-InvestigationThis issue requires detective work to figure out what's going wrongThis issue requires detective work to figure out what's going wrong