Skip to content

Spawning any Sprite logs an "unresolved import" warning for mesh2d::bindings at startup #25936

Description

@viridia

Bevy version and features

0.20.0-rc.1.

[Optional] Relevant system information

macOS 15.6 (Darwin 24.6.0), Apple Silicon, Metal. Native build.

What you did

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, |mut commands: Commands| {
            commands.spawn(Camera2d);
            commands.spawn(Sprite::from_color(Color::WHITE, Vec2::splat(100.0)));
        })
        .run();
}

What went wrong

A warning at startup:

WARN bevy_shader::shader_cache: Shader `embedded://bevy_sprite_render/sprite_mesh/sprite_material.wesl` has an unresolved import:
error: module not found: `bevy_sprite_render::mesh2d::bindings` (no shader registered for this module path)
  |
  = note: in bevy_sprite_render::sprite_mesh::sprite_material (embedded://bevy_sprite_render/sprite_mesh/sprite_material.wesl)

The sprite renders correctly. The warning is spurious: the import resolves on a later frame.

Additional information

Since #25432, every Sprite is drawn through SpriteMaterial, whose shader imports mesh2d::bindings. That module is not registered at build time: load_mesh2d_bindings loads it through the asset server in RenderStartup, because its shader defs depend on the device's limits. When the sprite pipeline is first queued before that load finishes, ShaderCache hits ModuleNotFound, warns once, and returns ShaderImportNotYetAvailable, and the pipeline succeeds on a later retry.

See also #25363.

Disclosure: some parts of this issue were generated by Claude Opus 5.5 and then manually edited.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-BugAn unexpected or incorrect behaviorS-Needs-TriageThis issue needs to be labelled

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions