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

No enum component example #11344

Closed
MrGVSV opened this issue Jan 14, 2024 · 1 comment · Fixed by #13777
Closed

No enum component example #11344

MrGVSV opened this issue Jan 14, 2024 · 1 comment · Fixed by #13777
Labels
A-ECS Entities, components, systems, and events C-Examples An addition or correction to our examples

Comments

@MrGVSV
Copy link
Member

MrGVSV commented Jan 14, 2024

How can Bevy's documentation be improved?

The ecs_guide example doesn't seem to include an example for enum components.

Since updating an enum component's variant requires a dereference (i.e. *foo = Foo::Bar), it can be confusing to first-time users. This should be included either in that example or a dedicated enum component example.

It would also be worth demonstrating how to pattern match against a mutable enum component as well.

@MrGVSV MrGVSV added A-ECS Entities, components, systems, and events C-Examples An addition or correction to our examples labels Jan 14, 2024
@doonv
Copy link
Contributor

doonv commented Jan 14, 2024

Same is true for updating an entire struct resource at once. i.e. *foo = Foo { bar: 5.0 }

github-merge-queue bot pushed a commit that referenced this issue Jun 25, 2024
# Objective

Add example of an enum Component to ecs_guide.

Fixes #11344.

## Solution

Extended ecs_guide "game" to include an enum tracking whether a player
is on a "hot" or "cold" streak.

## Testing

Ran example manually.


cc @MrGVSV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Examples An addition or correction to our examples
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants