Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] API for adding, replacing components should be extended #8

Open
jeffcampbellmakesgames opened this issue May 15, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@jeffcampbellmakesgames
Copy link
Owner

Is your feature request related to a problem? Please describe.

Currently, the API for modifying components on an Entity involves passing all of the properties of that component into a method either adding that component or replacing an existing component.

image

This works alright for components with one or two fields, but after several fields this can be a bit exhausting, particularly if you only want to modify one or two fields.

Describe the solution you'd like

Ideally, there should be a way to be able to modify a subset of a component's fields without needing to call either Add or Replace with the superset of all of that component's fields AND still have the appropriate Events be called for Adding, Replacing, or Removing a component and work with component pooling. There are a couple of options to look into:

  • The property for a non-flag component is currently get-only. This could be changed to include a setter.
  • Add and Replace component method overloads could be added that accept a component value.

For all of these options, their internal implementation would obey the same logic rules for events, pooling and require additional unit tests to verify that.

Describe alternatives you've considered
It is possible right now to get an existing component and modify one or two fields directly on it without calling Entity methods for Replacing, but this can only be done in this context and it does not trigger events for the entity's component being updated.

@jeffcampbellmakesgames jeffcampbellmakesgames added the enhancement New feature or request label May 15, 2020
@jeffcampbellmakesgames jeffcampbellmakesgames added this to the v1.3.0 milestone Aug 7, 2020
@jeffcampbellmakesgames
Copy link
Owner Author

With the addition of blueprints a new component API was added for Entities for Copy_ComponentName_To that enables a developer to copy the members of an existing component to an entity as a new component or a new one or an existing one.

@jeffcampbellmakesgames jeffcampbellmakesgames removed this from the v1.3.0 milestone Sep 4, 2020
@jeffcampbellmakesgames
Copy link
Owner Author

Pulling this off of a milestone for now as some partial progress has been made, but I want to brainstorm this over further to come up with a better defined set of API changes for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant