#I want to modify the bmp for an object texture in real-time, and have the model update.
2 messages · Page 1 of 1 (latest)
fn right_click_texture_edit( mouse_button_input: Res<ButtonInput<MouseButton>>,
asset_server: Res<AssetServer>,
new_material_query: Query<&Handle<StandardMaterial>, With<TextureChangeRequest>>,
mut materials: ResMut<Assets<StandardMaterial>>,
){
if mouse_button_input.just_pressed(MouseButton::Right) {
let material_handle = new_material_query.get_single().expect("Query not succesful");
let my_material = materials.get_mut(material_handle).unwrap();
let texture_handle_five = asset_server.load("Stage5.bmp");
my_material.base_color_texture = Some(texture_handle_five.clone());
}
}