bevy
bevy copied to clipboard
Don't Serialize Meta-data componts in dynamic scene
What problem does this solve or what need does it fill?
at the moment bevy dynamic scene are already bloated with having to Serialize the type name and value separately and as strings. so to cut down on some bloat and make the files more readable and editable it should not serialize purely computed structs such as GlobalTransform and ComputedVisibility the developers should not be manually setting the value for insertion anyway.
What solution would you like?
- remove reflect component from all meta-data type structs. e.g. GlobalTransform, ComputedVisibility
- move the insertion of the required meta-data struct onto the reflect components implementation. e.g. reflect inserting Transform should also insert GlobalTransform.
- expand reflect component macro to accept optional Depecnecy component tuple that will be inserted with default values when the reflect insert is used
#[derive(Default, Component, Reflect, Serialize, Deserialize)]
#[reflect(Component(GlobalTransform), Serialize, Deserialize)]
struct Transform{...};
What alternative(s) have you considered?
this would depend on if there is ever a situation you would want a transform but not a global transform.
- expand derive Component macro to accept optional Depecnecy component tuple that will be inserted with default values whenever inserting the component like a bundle but always default
#[derive(Default, Component(GlobalTransform), Reflect, Serialize, Deserialize)]
#[reflect(Component, Serialize, Deserialize)]
struct Transform{...};