-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Remove Component
trait impl from Handle<T>
#15716
Comments
This will also resolve #14124 (migrating entirely to |
I thought I remembered there being an issue related to this already :) I haven't created an issue for |
@tim-blackbird I think the new handle wrapper components need to be registered in the type registry. I tried locally myself changing one of my own Separately, I was also wondering if the engine should have a macro for this boilerplate? bevy/crates/bevy_animation/src/graph.rs Lines 133 to 149 in 700123e
|
I always forget to add those calls to We could potentially make use of the |
…nent` (#15749) # Objective - Another step towards #15716 - Remove trait implementations that are dependent on `Handle<T>` being a `Component` ## Solution - Remove unused `ExtractComponent` trait implementation for `Handle<T>` - Remove unused `ExtractInstance` trait implementation for `AssetId` - Although the `ExtractInstance` trait wasn't used, the `AssetId`s were being stored inside of `ExtractedInstances` which has an `ExtractInstance` trait bound on its contents. I've upgraded the `RenderMaterialInstances` type alias to be its own resource, identical to `ExtractedInstances<AssetId<M>>` to get around that with minimal breakage. ## Testing Tested `many_cubes`, rendering did not explode
# Objective - Closes #15716 - Closes #15718 ## Solution - Replace `Handle<MeshletMesh>` with a new `MeshletMesh3d` component - As expected there were some random things that needed fixing: - A couple tests were storing handles just to prevent them from being dropped I believe, which seems to have been unnecessary in some. - The `SpriteBundle` still had a `Handle<Image>` field. I've removed this. - Tests in `bevy_sprite` incorrectly added a `Handle<Image>` field outside of the `Sprite` component. - A few examples were still inserting `Handle`s, switched those to their corresponding wrappers. - 2 examples that were still querying for `Handle<Image>` were changed to query `Sprite` ## Testing - I've verified that the changed example work now ## Migration Guide `Handle` can no longer be used as a `Component`. All existing Bevy types using this pattern have been wrapped in their own semantically meaningful type. You should do the same for any custom `Handle` components your project needs. The `Handle<MeshletMesh>` component is now `MeshletMesh3d`. The `WithMeshletMesh` type alias has been removed. Use `With<MeshletMesh3d>` instead.
Objective
Remove the
Component
trait implementation fromHandle<T>
as its usage is now considered an anti-pattern.The move to required components has notably made porting error prone both internally and for the code of early adopters. Due a lack of errors on the usage of high-profile but now no longer relevant
Handle
components likeHandle<Mesh>
andHandle<StandardMaterial>
.The text was updated successfully, but these errors were encountered: