-
Notifications
You must be signed in to change notification settings - Fork 115
When adding a new component return it instead of the entity itself #24
Comments
Yes, I'd really like I'm not sure what should happen with regard to triggering the |
Mostly indifferent to returning the component or entity, but it doesn't seem right to be modifying a component ref you didn't get from |
Yeah, just passing the instance is probably fine too. It just depends on how we implement pooling. If If you acquire a new component instance from some other method like |
Leaving it like this (= returning the entity) in favor to https://github.com/fernandojsg/ecsy/issues/81 to avoid side effects or unwanted use cases as storing a reference to an component or so |
Currently
addComponent
return the entity instead of the component, so you could chain them as:But if you want to set component values directly without passing an object on the
addComponent
function, it could be nice to return the component directly:One question would be if we would like that behaviour to be the same as if we would do
getMutableComponent
so it will trigger thechanged
. But as we are just creating it, I believe that just triggering theadded
event should be enough for now.The text was updated successfully, but these errors were encountered: