Skip to content

Implements merge_scene variant function.#24932

Draft
l-monninger wants to merge 5 commits into
bevyengine:mainfrom
ramate-io:merge-scene-variant-function
Draft

Implements merge_scene variant function.#24932
l-monninger wants to merge 5 commits into
bevyengine:mainfrom
ramate-io:merge-scene-variant-function

Conversation

@l-monninger

@l-monninger l-monninger commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Objective

Solution

Critically:

    fn patch_scene<S: Scene>(
        &mut self,
        scene: S,
        relationship_behavior: RelationshipBehavior,
    ) -> Result<(), SpawnSceneError>;

    fn apply_scene<S: Scene>(&mut self, scene: S) -> Result<(), SpawnSceneError> {
        self.patch_scene(scene, RelationshipBehavior::Overwrite)
    }

    fn merge_scene<S: Scene>(&mut self, scene: S) -> Result<(), SpawnSceneError> {
        self.patch_scene(scene, RelationshipBehavior::Merge)
    }
  • I used default implementations on the trait to extend marker behavior to a variant function merge_scene.

Testing

  • See unit tests at the bottom of spawn.rs.

Draft Notes

As we start to consider this feature, I would like to note there are, in fact, several potentially configurable behaviors:

  1. Do we want to overwrite or extend the relationships? (This is the RelationshipBehavior provided here.)
  2. If we are overwriting relationships, do we want to orphan exiting relationships or despawn them? (RelationshipGc)
    • Do we want to despawn certain types of relationships? Entities matching certain bundles?
    • At what point does controlling this sort of thing become better as some kind of bespoke system?
  3. Is the RelationshipBehavior used material? (MaterializeRelationshipBehavior)
  4. If RelationshipBehaviors are material, does the pre-existing RelationshipBehavior or the behavior entering with the scene take precedence?

@l-monninger l-monninger changed the title Implements merge_scene variant function and behavioral marker. Behavior based on value of component on existing entity. Implements merge_scene variant function and behavioral marker. Jul 9, 2026
@l-monninger l-monninger changed the title Implements merge_scene variant function and behavioral marker. Implements merge_scene variant function. Jul 11, 2026
@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-Scenes Composing and serializing ECS objects S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Jul 12, 2026
@alice-i-cecile
alice-i-cecile requested a review from cart July 12, 2026 18:46
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 C-Feature A new feature, making something new possible S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants