-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Follow up on Retained Rendering #15459
Comments
We should probably also remove the in-engine uses of TemporaryRenderEntity if possible. |
Yes, definitely a good idea. Although I expect the solutions for that to be more specific to the rendering contexts in which they are used. |
From |
# Objective After merging retained rendering world #15320, we now have a good way of creating a link between worlds (*HIYAA intensifies*). This means that `get_or_spawn` is no longer necessary for that function. Entity should be opaque as the warning above `get_or_spawn` says. This is also part of #15459. I'm deprecating `get_or_spawn_batch` in a different PR in order to keep the PR small in size. ## Solution Deprecate `get_or_spawn` and replace it with `get_entity` in most contexts. If it's possible to query `&RenderEntity`, then the entity is synced and `render_entity.id()` is initialized in the render world. ## Migration Guide If you are given an `Entity` and you want to do something with it, use `Commands.entity(...)` or `World.entity(...)`. If instead you want to spawn something use `Commands.spawn(...)` or `World.spawn(...)`. If you are not sure if an entity exists, you can always use `get_entity` and match on the `Option<...>` that is returned. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
I think we've covered everything but #15704 now? |
Merging #15320 leaves behind a couple of gaps that can be easily filled in a follow-up PR(s).
Implement
WorldQuery
forRenderEntity
andMainEntity
When querying
&RenderEntity
currently from within the main world (orExtract
systems in the render world), you constantly have to call.id()
on every thing you query, becauseRenderEntity
is a component that contains an entity. This indirection is annoying and makes the migration to 0.15 more cumbersome (more line changes), so we can implement a customWorldQuery
so that this happens automatically (think of queryingEntity
).The same is true for
MainEntity
.Using required components
There are a couple of places, mainly in
bevy_render/src/extract_component.rs
whereSyncToRenderWorld
is automatically added to certain components. This is currently done with observers, but it's much better to do this with required components. This is being tackled in #15582.Deprecating
get_or_spawn
get_or_spawn
Is quite often used in extraction systems, given how things used to work. But with a retained rendering world, the entity should always already exist, so justget
should suffice.The text was updated successfully, but these errors were encountered: