Skip to content

Remove resources from scenes#22968

Draft
Trashtalk217 wants to merge 1 commit intobevyengine:mainfrom
Trashtalk217:remove-resources-from-scenes
Draft

Remove resources from scenes#22968
Trashtalk217 wants to merge 1 commit intobevyengine:mainfrom
Trashtalk217:remove-resources-from-scenes

Conversation

@Trashtalk217
Copy link
Contributor

@Trashtalk217 Trashtalk217 commented Feb 15, 2026

Objective

Currently, in scenes, resources are stored like this:

(
  resources: {
    "scene::ResourceA": (
      score: 1,
    ),
  },
  entities: {
    4294967297: (
      components: {
        ...
      },
    ),
    4294967298: (
      components: {
        ...
      },
    ),
  },
)

Since resources-as-components (#20934), it has become possible to attach other components to the resource entities. This is very useful for networking and something we want to support. Currently, however, the scene format does not support additional components in the format. This means that this data will be lost when converting a world to a scene and back to a world. This loss can be a pain for people working with resources.

Solution

Since resources are already stored on entities, this PR removes resources: { ... } and instead everything is done on the entity level:

(
  entities: {
    4294967296: (
      components: {
        "scene::ResourceA": (
          score: 1,
        ),
        "bevy_ecs::resource::IsResource": ((12)),
        "replicon::Replicated": () // yay ^_^
      },
    ),
    4294967297: (
      components: {
        ...
      },
    ),
    4294967298: (
      components: {
        ...
      },
    ),
  },
)

Testing

TODO: Add a test, for what happens when a resource is loaded from a scene twice. What should that even do?

@Trashtalk217 Trashtalk217 added the A-Scenes Serialized ECS data stored on the disk label Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Scenes Serialized ECS data stored on the disk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant