Skip to content

Materials exported but not loaded in Bevy for standalone blueprints #254

@mertkasar

Description

@mertkasar

Tested on: 0.1.0-alpha.1 in Blender 4.2.3 LTS with default plugin settings.

Setup: I have a World scene and Library scene as suggested in the documentation. Prepared 2 blueprints for my player and obstacle objects in Library section and I marked them as Assets in Blender side.

Issue: It works as expected when I instance blueprints in the World scene in Blender side and load the World scene in Bevy side. All materials are loaded when spawning World.glb and blueprints look as they should have in game.

But if I remove my blueprint instances from the World scene in Blender and try to load them on demand in Bevy side with this suggested snippet, materials which used by the blueprint are not loaded in Bevy even though they are exported successfully from Blender project.

I noticed the assets array in .meta.ron files are empty for the exported blueprints. Manually adding the relevant materials to this array fixes the issue. Is there a specific reason that Blender plugin does not populate this array when exporting? Or is there a relevant setting I'm missing on?

Player and Obstacles are instanced in World scene in Blender:
instanced_blender

fn setup(mut commands: Commands) {
    commands.spawn((
        BlueprintInfo::from_path("levels/World.glb"),
        SpawnBlueprint,
        HideUntilReady,
        GameWorldTag,
    ));
}

Player is not in World scene but spawned separately in bevy side:
instanced_blender

fn setup(mut commands: Commands) {
    commands.spawn((
        BlueprintInfo::from_path("levels/World.glb"),
        SpawnBlueprint,
        HideUntilReady,
        GameWorldTag,
    ));

    commands.spawn((
        BlueprintInfo::from_path("blueprints/player.glb"),
        SpawnBlueprint,
        TransformBundle::from_transform(Transform::from_xyz(0.0, 0.0, 0.0)),
    ));
}

player.meta.ron

(
  assets:
   [ 
   ]
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions