bevy_missing_texture

Crates.iobevy_missing_texture
lib.rsbevy_missing_texture
version0.1.2
sourcesrc
created_at2023-08-03 04:10:55.668262
updated_at2023-08-03 20:25:38.239263
descriptionA library to help with missing textures in bevy
homepage
repository
max_upload_size
id933392
size13,076
Lemon (LemonjamesD)

documentation

README

Bevy library for Missing Textures

use bevy::prelude::*;
use bevy_missing_texture::*;
// Make sure to have `missing_texture.png` in your assets dir
fn main() {
    App::new()
        .add_plugins(MissingTexturePlugin)
        .add_systems(Startup, (will_fail, will_succeed));
}
// This will be replaced by the missing asset
fn will_fail(mut commands: Commands, asset_server: Res<AssetServer>, mut if_missing: ResMut<ReplaceIfMissing>) {
    let handle = asset_server.load("foo.png");
    commands.spawn(SpriteBundle {
        texture: handle.clone(),
        ..Default::default()
    });
    if_missing.push(handle);
}
// This will not be replaced by the missing asset
fn will_succeed(mut commands: Commands, asset_server: Res<AssetServer>, mut if_missing: ResMut<ReplaceIfMissing>) {
    let handle = asset_server.load("bar.png");
    commands.spawn(SpriteBundle {
        texture: handle.clone(),
        ..Default::default()
    });
    if_missing.push(handle);
}
Commit count: 0

cargo fmt