-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Refactor Component::init_component_hooks to split apart component hook methods #17411
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesA "normal" level of difficulty; suitable for simple features or challenging fixesS-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplished
Description
Activity
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesA "normal" level of difficulty; suitable for simple features or challenging fixesS-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplished
Component'sinit_component_hooksmethod is intimidating and a bit frustrating to use. The obvious solution is to simply make each type of component hook its own method.As @James-o-brien points out, the most naive solution won't work, because we want to cache whether or not each component has each kind of hook (stored in the flags on archetypes). As far as we know, there's no way to statically check if the function provided is actually a no-op.
This came up in the context of relationships.
Originally posted by @alice-i-cecile in #17398 (comment)