Skip to content

Update to bevy 0.19 - #242

Merged
ManevilleF merged 4 commits into
ManevilleF:mainfrom
kristoff3r:main
Jun 24, 2026
Merged

ManevilleF merged 4 commits into
ManevilleF:mainfrom
kristoff3r:main

Conversation

@kristoff3r

Copy link
Copy Markdown
Contributor

I tested a couple of examples, seems to work

@ManevilleF ManevilleF left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Could you explain why you removed the Component derives from all those types ?

Comment thread CHANGELOG.md Resolved
Co-authored-by: Félix Lescaudey de Maneville <felix.maneville@gmail.com>
@kristoff3r

kristoff3r commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the PR. Could you explain why you removed the Component derives from all those types ?

The same type can no longer be both a resource and a component, see https://bevy.org/learn/migration-guides/0-18-to-0-19/#derive-resource-implements-the-component-trait.

I was updating a bunch of my dependencies at the same time and I forgot to come back to the decision about what to do about the derives after I got my project to compile. I don't use these, so I don't know if component or resource is the most useful. Maybe the more principled solution is to remove both and let users do their own wrappers?

@kristoff3r

Copy link
Copy Markdown
Contributor Author

I also didn't notice the clippy issues, I'm fixing those as well

@ManevilleF

Copy link
Copy Markdown
Owner

I agree, we should remove both and add an entry in the docs that the user needs to make its own wrapper

@ManevilleF ManevilleF added the bevy Bevy engine related label Jun 24, 2026
@stijn-schack

stijn-schack commented Jun 24, 2026 •

Copy link
Copy Markdown

Stumbled upon this PR while updating my project to bevy 0.19 so I thought I'd pitch in.
Removing both Component and Resource derives does seem like the best option, but if you do end up deciding to keep one of them I would suggest keeping the Component derive.

My reasoning is that deriving Resource locks users into a singleton-like pattern. While if you were to choose component, users could still mark an entity as the primary source using one of the following patterns:

#[derive(Resource)]
struct PrimaryHexLayout(Entity);

fn my_setup_system(mut commands Commands) {
   let layout = /* construct HexLayout */
   let entity = commands.spawn(layout).id();
   commands.insert_resource(PrimaryHexLayout(entity));
}

fn my_query_system(primary_layout: Res<PrimaryHexLayout>, layouts: Query<&HexLayout>) {
  let layout = layouts.get(primary_layout.0);
}

or preferably:

#[derive(Component)]
struct PrimaryHexLayout;

fn my_setup_system(mut commands Commands) {
   let layout = /* construct HexLayout */
   commands.spawn((layout, PrimaryHexLayout));
}

fn my_query_system(primary_layout: Single<&HexLayout, With<PrimaryLayout>>) {
  let layout = *primary_layout;
}

@ManevilleF

Copy link
Copy Markdown
Owner

Fair point, Component is the most likely to be used for those types.
But in any case I don't think it's the responsibility of hexx to make that kind of choice in the first place.

The idea was to simplify the developer experience, but the decision bevy made regarding resources and components makes it obsolete.

So I think we should remove both, or at least Resource, and potentially we could provide wrappers in the future. I always wanted to provide a bevy_hexx plugin with utility types and methods. The changelog should also make that clear

Do we use those component/resources derives in tests/examples ?

@kristoff3r

Copy link
Copy Markdown
Contributor Author

Fair point, Component is the most likely to be used for those types. But in any case I don't think it's the responsibility of hexx to make that kind of choice in the first place.

The idea was to simplify the developer experience, but the decision bevy made regarding resources and components makes it obsolete.

So I think we should remove both, or at least Resource, and potentially we could provide wrappers in the future. I always wanted to provide a bevy_hexx plugin with utility types and methods. The changelog should also make that clear

Do we use those component/resources derives in tests/examples ?

Resource is used in one place, it was easy to replace with a wrapper.

I pushed a commit removing the affected derives. I added notes to the changelog and updated docs a bit, let me know if you want more docs somewhere.

There is only one derive left behind the bevy_ecs feature, namely Component for Hex. I considered removing it as well, but that's potentially a bigger change.

@ManevilleF ManevilleF left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your work

@ManevilleF
ManevilleF enabled auto-merge (squash) June 24, 2026 08:00
@ManevilleF
ManevilleF merged commit e283088 into ManevilleF:main Jun 24, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bevy Bevy engine related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants