I'm trying to get get the trait of a type. but it's a DynamicStruct(pgc::powerups::projectiles::poisenous::PoisenousProjectiles)
so my current code is this:
let reflect = component.0.as_ref(); // DynamicStruct
let represented_info = reflect.get_represented_type_info().unwrap();
let reflect_powerup_descriptor = type_registry
.get_type_data::<ReflectPowerupDescriptor>(
represented_info.type_id(),
)
.unwrap(); // Works!
let powerup_descriptor = reflect_powerup_descriptor.get(reflect).unwrap(); // Crashes!
println!("Powerup: {:?}", powerup_descriptor.describe());
so what i think the problem is, is that reflect is still the dynamic type, and not the actual one, so it of course doesn't implement PowerupDescriptor... so how can i correctly get the trait then?