-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Components as entities (v2) #24728
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
Open
Trashtalk217
wants to merge
24
commits into
bevyengine:main
Choose a base branch
from
Trashtalk217:components-as-entities-alt
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+652
−947
Open
Components as entities (v2) #24728
Changes from 13 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
22e24fb
make ComponentId use Entity
Trashtalk217 96d54c9
removed ResourceEntities
Trashtalk217 45ff041
fix world_serialization tests
Trashtalk217 5e9d8fa
add PR number
Trashtalk217 16f2b9e
fix bevy_remote
Trashtalk217 c6d1670
fix dynamic example
Trashtalk217 a7d5879
fix doc test
Trashtalk217 eed38d9
fix bevy_settings test
Trashtalk217 a6d7ea3
forgot to remove a println!
Trashtalk217 9056e8a
fix benchmark
Trashtalk217 8430a66
Merge branch 'main' of https://github.com/bevyengine/bevy into compon…
Trashtalk217 63cd089
improved migration guide, added iter_registered_ids, addressed review
Trashtalk217 50ec233
markdown error
Trashtalk217 731b5e6
addressed most of chescocks review
Trashtalk217 05c6204
clippy
Trashtalk217 cc02f45
address review pt 2
Trashtalk217 958d2bb
fix test
Trashtalk217 50af152
address UB concerns
Trashtalk217 3f3d76a
I'm a big dumb idiot who should test their code
Trashtalk217 de65238
clippy
Trashtalk217 b02a412
migration guide
Trashtalk217 c2678eb
Apply suggestions from code review
Trashtalk217 56009dc
removed tests, changed bevy_settings
Trashtalk217 2c764e6
format
Trashtalk217 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
_release-content/migration-guides/components-as-entities.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| title: "Components as Entities" | ||
| pull_requests: [24728] | ||
| --- | ||
|
|
||
| - `ComponentId::new` now takes `Entity` as an argument instead of `usize`. For debugging, you can use `ComponentId::index`. | ||
| - `ComponentId::index` was removed in favor of implementing `ContainsEntity`, call `ComponentId::entity` to get the underlying entity. | ||
| - `ComponentIdSet` is now an `EntityEquivalentHashSet` instead of a `FixedBitSet`. This means that methods like `union_with` no longer work, use `bitor_assign` instead. | ||
| - `ComponentIds` has been removed. Instead of `ComponentIds`, `ComponentsRegistrator::new` now takes `EntityAllocator`, while `ComponentsQueuedRegistrator::new` now takes `RemoteAllocator`. | ||
| - `Access` and `EcsAccessType` no longer derive `Hash`. | ||
| - `ResourceEntities` was removed. The following methods have been removed with it: `World::resource_entities`, `EntityWorldMut::resource_entities`, `UnsafeWorldCell::resource_entities`. If you need the entity linked with a `ComponentId`, simply call `component_id.entity()`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,14 @@ | ||
| //! Constant components included in every world. | ||
|
|
||
| /// `usize` for the [`Add`](crate::lifecycle::Add) component used in lifecycle observers. | ||
| pub const ADD: usize = 0; | ||
| /// `usize` for the [`Insert`](crate::lifecycle::Insert) component used in lifecycle observers. | ||
| pub const INSERT: usize = 1; | ||
| /// `usize` for the [`Discard`](crate::lifecycle::Discard) component used in lifecycle observers. | ||
| pub const DISCARD: usize = 2; | ||
| /// `usize` for the [`Remove`](crate::lifecycle::Remove) component used in lifecycle observers. | ||
| pub const REMOVE: usize = 3; | ||
| /// `usize` for [`Despawn`](crate::lifecycle::Despawn) component used in lifecycle observers. | ||
| pub const DESPAWN: usize = 4; | ||
| /// `usize` of the [`IsResource`](crate::resource::IsResource) component used to mark entities with resources. | ||
| pub const IS_RESOURCE: usize = 5; | ||
| /// `u32` for the [`Add`](crate::lifecycle::Add) component used in lifecycle observers. | ||
| pub const ADD: u32 = 0; | ||
| /// `u32` for the [`Insert`](crate::lifecycle::Insert) component used in lifecycle observers. | ||
| pub const INSERT: u32 = 1; | ||
| /// `u32` for the [`Discard`](crate::lifecycle::Discard) component used in lifecycle observers. | ||
| pub const DISCARD: u32 = 2; | ||
| /// `u32` for the [`Remove`](crate::lifecycle::Remove) component used in lifecycle observers. | ||
| pub const REMOVE: u32 = 3; | ||
| /// `u32` for [`Despawn`](crate::lifecycle::Despawn) component used in lifecycle observers. | ||
| pub const DESPAWN: u32 = 4; | ||
| /// `u32` of the [`IsResource`](crate::resource::IsResource) component used to mark entities with resources. | ||
| pub const IS_RESOURCE: u32 = 5; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.