bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Ignore a type when registered

Open BenjaminBrienen opened this issue 1 year ago • 2 comments

There should be a way of saying to ignore a whole type when you register it. For example, marker types such as PhantomData.

https://github.com/bevyengine/bevy/pull/15313#issuecomment-2365454473

Related: #5144

BenjaminBrienen avatar Oct 10 '24 03:10 BenjaminBrienen

Is this a suggestion to add a new attribute like #[reflect(skip_register)], or something along the line of "always ignore phantom data when registering types"? If the solution is to implement a new attribute like this, why not ignore PhantomData with #[reflect(ignore)]?

pablo-lua avatar Oct 10 '24 23:10 pablo-lua

Is this a suggestion to add a new attribute like #[reflect(skip_register)], or something along the line of "always ignore phantom data when registering types"? If the solution is to implement a new attribute like this, why not ignore PhantomData with #[reflect(ignore)]?

The idea is that bevy knows some types will always be #[reflect(ignore)] and it would be convenient if users don't have to annotate it every time. If we can have bevy handle this for std types and enable users to do this for their own types, we can lessen the verboseness of bevy programs. Maybe we could add a derive trait such as ReflectIgnore.

BenjaminBrienen avatar Oct 10 '24 23:10 BenjaminBrienen