-
I'm trying to change the colour on a StandardMaterial. I had this working previously by using a query to get the material reference:
however I had to make my Edit:
Then I get the material from the asset resource and set the
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The first setup doesn't work any more because now the entity with the fn change_material(
enemies: Query<&Children, With<Enemy>>,
mut standard_materials: Query<&mut Handle<StandardMaterial>> ,
) {
for children_of_enemy in enemies.iter() {
for child in children_of_enemy.iter() {
if let Ok(handle) = standard_materials.get_mut(child) {
// etc
}
}
}
} In the second case it doesn't work because you need to substitute the Hope it was helpful! |
Beta Was this translation helpful? Give feedback.
The first setup doesn't work any more because now the entity with the
PbrBundle
is a child ofEnemy
, whoseEntity
is stored in theChildren
component. So to access the material handle, you now need two queries:In the second case it doesn't work because you need to substitute the
Handle
, not mutate the colour. If you change the colour, you ne…