Skip to content

Remove bevy_camera dependency from bevy_world_serialization#24963

Open
Functionhx wants to merge 3 commits into
bevyengine:mainfrom
Functionhx:fix/bevy-24805-remove-camera-dep
Open

Remove bevy_camera dependency from bevy_world_serialization#24963
Functionhx wants to merge 3 commits into
bevyengine:mainfrom
Functionhx:fix/bevy-24805-remove-camera-dep

Conversation

@Functionhx

@Functionhx Functionhx commented Jul 12, 2026

Copy link
Copy Markdown

Objective

Fixes #24805. Removes the bevy_camera dependency from bevy_world_serialization, which had no functional need for it — it was only used for #[require(Visibility)] annotations on WorldAssetRoot and DynamicWorldRoot.

Per #24805 (comment)

Solution

  • Removed #[require(Visibility)] from WorldAssetRoot and DynamicWorldRoot
  • Removed bevy_camera from Cargo.toml dependencies
  • Removed the use bevy_camera::visibility::Visibility import

Testing

  • cargo check -p bevy_world_serialization — zero references to bevy_camera remain
  • No other crates depend on WorldAssetRoot or DynamicWorldRoot auto-inserting Visibility

Migration Guide

Users who relied on WorldAssetRoot or DynamicWorldRoot auto-inserting Visibility should now add Visibility explicitly when spawning these components.

The only usage was #[require(Visibility)] on WorldAssetRoot and
DynamicWorldRoot. Per maintainer approval, removing these since
Visibility does not belong in a serialization crate.

Fixes bevyengine#24805

Signed-off-by: Yuchen Fan <functionhx@gmail.com>
Signed-off-by: Functionhx <2994114386@qq.com>
Signed-off-by: Yuchen Fan <functionhx@gmail.com>
@Functionhx Functionhx marked this pull request as ready for review July 12, 2026 17:14
@alice-i-cecile alice-i-cecile requested a review from atlv24 July 12, 2026 18:42
@alice-i-cecile alice-i-cecile added A-Scenes Composing and serializing ECS objects M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 12, 2026
Comment thread _release-content/migration-guides/world_root_visibility.md
Per reviewer suggestion: mention that apps can use
register_required_components to restore automatic Visibility insertion
without pulling bevy_camera into bevy_world_serialization.

Signed-off-by: Functionhx <2994114386@qq.com>
Signed-off-by: Yuchen Fan <functionhx@gmail.com>
@alice-i-cecile alice-i-cecile added this to the 0.20 milestone Jul 13, 2026
@alice-i-cecile alice-i-cecile requested review from cart and kfc35 July 13, 2026 04:12
)]
#[reflect(Component, Default, Debug, PartialEq, Clone)]
#[require(Transform)]
#[require(Visibility)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Visibility and Transform are present on this because we currently use bevy_world_serialization (and these components specifically) when spawning scenes like glTF (bevy_world_serialization is the precursor to BSN). In that context, we need both Transform and Visibility for it to behave as expected. This is because the "serialized world" is spawned beneath the root entity.

A general purpose "world serialization" library definitely shouldn't be hard-coding these things. But it is currently still filling the role of a "scene system" until glTF is ported to BSN.

I think we shouldn't make these changes until glTF is ported to BSN (which would ideally happen this cycle).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Additionally, once the glTF port happens, we should:

  1. Remove the required Transform too
  2. Look into "flat spawning" world serialization APIs that don't spawn things "under".

@alice-i-cecile alice-i-cecile added S-Blocked This cannot move forward until something else changes X-Contentious There are nontrivial implications that should be thought through and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Scenes Composing and serializing ECS objects D-Straightforward Simple bug fixes and API improvements, docs, test and examples M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Blocked This cannot move forward until something else changes X-Contentious There are nontrivial implications that should be thought through

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bevy_world_serialization depends on bevy_camera unconditionally in 0.19

3 participants