#Why doesn't it create the handle at all?

171 messages ยท Page 1 of 1 (latest)

river spire
#

in hold_handle it just doesn't create the handle which causes the game to just crash

lyric moth
#

What does " it just doesn't create the handle" mean

river spire
#

I take back what I say now

#

but it fails it just creates it's in a NtoLoaded state

#

which is still weird to me

lyric moth
#

When are you observing this

#

missing_texture?

river spire
#

in the missing_texture_internal

#

and that

#

it prints the states

#

for me

lyric moth
#

Is it crashing?

river spire
#

no

#

not anymore

#

updated the code

#

I accidentally deleted the code

#

thanks discord

#

I don't know how

lyric moth
#

๐Ÿ‡ซ

#

And this is continuously printing statements each frame right? It never prints green?

river spire
#
use bevy::asset::{HandleId, LoadState};
use bevy::prelude::*;
use colored::Colorize;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, (startup, missing_texture_startup))
        .add_systems(
            Update,
            (
                missing_texture_sprite,
                hold_handle,
                apply_deferred,
                missing_texture,
            )
                .chain(),
        )
        .run();
}

fn startup(mut commands: Commands) {
    commands.spawn(Camera2dBundle::default());
}

#[derive(Component)]
struct HoldHandle(Handle<Image>);

fn missing_texture_sprite(mut commands: Commands, asset_server: Res<AssetServer>) {
    let handle = asset_server.load("missing_texture.png");
    commands.spawn(SpriteBundle {
        texture: handle.clone(),
        transform: Transform::from_xyz(0.0, 10.0, 0.0),
        ..Default::default()
    });
}

fn hold_handle(mut commands: Commands, asset_server: Res<AssetServer>) {
    let handle = asset_server.load("foo.png");
    commands.spawn(SpriteBundle {
        texture: handle.clone(),
        ..Default::default()
    });
    commands.spawn_empty().insert(HoldHandle(handle));
}

#[derive(Component)]
struct MissingTexture(Handle<Image>);

fn missing_texture_startup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn_empty().insert(MissingTexture(
        asset_server.load("textures/missing_texture.png"),
    ));
}

fn missing_texture(
    asset_server: Res<AssetServer>,
    mut image_event: EventReader<AssetEvent<Image>>,
    mut images: ResMut<Assets<Image>>,
    missing_texture: Query<&MissingTexture>,
) {
    let mut stored = vec![];
    let missing_texture = missing_texture.get_single().unwrap();
    for handle in images.ids() {
        info!("{}", "------".green());
        info!("{handle:?} {:?}", missing_texture.0);
        // if handle == missing_texture.0.id {
        //     warn!("Early return");
        //     return;
        // }
        stored.push(missing_texture_internal(
            &asset_server,
            &images,
            handle.clone(),
            missing_texture,
        ));
        info!("{}", "------".red());
    }

    for x in stored {
        let Some(x) = x else { continue };
        info!("{:?}", x.0);
        images.set(x.0, x.1);
    }
}

fn missing_texture_internal(
    asset_server: &AssetServer,
    images: &Assets<Image>,
    handle: HandleId,
    missing_texture: &MissingTexture,
) -> Option<(Handle<Image>, Image)> {
    info!("Event: {handle:?}");
    let loadstate = asset_server.get_group_load_state(vec![handle.clone()]);
    match loadstate {
        LoadState::Failed => {
            info!("{}: {loadstate:?}", "Did Not Load Succesfully".red());
            let image = images.get(&missing_texture.0).unwrap();
            return Some((Handle::weak(handle), image.clone()));
        }
        _ => {
            info!("{}: {loadstate:?}", "Loaded Successfully".green());
        }
    };
    None
}
#

yes

lyric moth
#

Does the state just flip to NotLoaded or does it ever become Unloaded?

river spire
#

it always prints NotLoaded

#

it gets the missing texture thing as loaded but the other one is not loaded

lyric moth
#

And there is an /assets/textures/foo.png file in your cargo project directory?

river spire
#

no

#

the point is there's not supposed to be

#

I'm trying to inject a handle if there is no file

lyric moth
#

So the missing texture loads?

#

OH

#

I understand what's going on

river spire
#

I don't I think I do ๐Ÿ˜…

lyric moth
#

So at what point are you trying to get the missing texture, that you expect to exist already, and doesn't?

river spire
#

I'm already getting missing texture

#

and it exists

#

because it's in startup

lyric moth
#

I meant HoldHandle

#

The handle for foo

river spire
#

oh

#

in missing_texture I'm just itering the assets

#

which gets the foo handle

#

but it's NotLoaded

#

but it should be Failed right?

#

so either I'm doing silly stuff or it should be Failed

lyric moth
#

Ok what I think is happening is that you're chaining the load rs .add_systems( Update, ( missing_texture_sprite, hold_handle, apply_deferred, missing_texture, ) .chain(), )

#

Every frame it tries to load a new handle

#

When you add a Resource of the same type, it drops the old one and sets the new one, so the old handles are being dropped

river spire
#

there is no resource

#

only component

lyric moth
#

Oh, HoldHandle is a Component

#

I'm unsure then, my test came back with them Failing just fine

river spire
#

what was your test?

lyric moth
#
use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, spawn1)
        .add_systems(Update, (spawn2, apply_deferred, print).chain())
        .run();
}

#[derive(Resource)]
struct Foo(pub Handle<Image>);
#[derive(Resource)]
struct Bar(pub Handle<Image>);

fn spawn1(mut commands: Commands,
         asset_server: Res<AssetServer>,
) {
    commands.insert_resource(Foo(asset_server.load("textures/missing_texture.png")));
}

fn spawn2(mut commands: Commands,
         asset_server: Res<AssetServer>,
) {
    commands.insert_resource(Bar(asset_server.load("textures/foo.png")));
}

fn print(foo: Res<Bar>, asset_server: Res<AssetServer>, mut image_event: EventReader<AssetEvent<Image>>) {
    for event in image_event.iter() {
        match event {
            AssetEvent::Created { handle } => println!("Created {handle:?}"),
            AssetEvent::Modified { handle } => println!("Modified {handle:?}"),
            AssetEvent::Removed { handle } => println!("Removed{handle:?}"),
        }
    }
    println!("Res: {:?}", asset_server.get_load_state(foo.0.clone()));
    println!("Res: {:?}", asset_server.get_group_load_state(vec![foo.0.id()]));

}``` In the middle of trying something different
#

This flips between Loading and Failed each frame

#

No, this test indicates a difference between get_load_state and get_group_load_state - check the last two print statements I get behavior like ```rs
Res: Loading
Res2: Failed

river spire
#

I'm almost ready to give up honestly

#

this is a bunch of bs

#

I feel like I've done everything rigwt

#

does it just consider blank handles as NotLoaded

#

that sounds like a bug imo

spare dirge
#

If you load you always get a non-blank Handle

river spire
#

but the load failud

spare dirge
#

That doesn't matter for the handle, it's basically just a unique number that points to an asset if it ever loads. The handle is just used to keep track of if anything uses it

#

If all handles are dropped, or there are only weak handles remaining, the asset is dropped and changes the state to NotLoaded

river spire
#

but it has a strong handle to the thing

#

it's stored even

#

in 2 places

spare dirge
#

Are any of the code snippets still up-to-date?

river spire
#

yes

#

the one I posted is good

lyric moth
#

after reading the docs, I think you need to do rs x.1 = images.set(x.0, x.1);

river spire
#

that looks cursed but I will try I guess

spare dirge
#

Whats with the unnamed tuple fields tho, give them a name :')

lyric moth
#

I believe what's happening is, as Nise says, it's dropping the asset pointed by the old x.1 and you're checking that, but we're getting a new handle instead

river spire
#

also let me name the fields and post the new code

#
use bevy::asset::{HandleId, LoadState};
use bevy::prelude::*;
use colored::Colorize;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(
            Startup,
            (
                startup,
                missing_texture_startup,
                missing_texture_sprite,
                hold_handle,
            ),
        )
        .add_systems(PostUpdate, missing_texture.chain())
        .run();
}

fn startup(mut commands: Commands) {
    commands.spawn(Camera2dBundle::default());
}

#[derive(Component)]
struct HoldHandle(Handle<Image>);

fn missing_texture_sprite(mut commands: Commands, asset_server: Res<AssetServer>) {
    let handle = asset_server.load("missing_texture.png");
    commands.spawn(SpriteBundle {
        texture: handle.clone(),
        transform: Transform::from_xyz(0.0, 100.0, 0.0),
        ..Default::default()
    });
}

fn hold_handle(mut commands: Commands, asset_server: Res<AssetServer>) {
    let handle = asset_server.load("foo.png");
    commands.spawn(SpriteBundle {
        texture: handle.clone(),
        ..Default::default()
    });
    commands.spawn_empty().insert(HoldHandle(handle));
}

#[derive(Component)]
struct MissingTexture(Handle<Image>);

fn missing_texture_startup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn_empty().insert(MissingTexture(
        asset_server.load("textures/missing_texture.png"),
    ));
}

fn missing_texture(
    asset_server: Res<AssetServer>,
    mut image_event: EventReader<AssetEvent<Image>>,
    mut images: ResMut<Assets<Image>>,
    missing_texture: Query<&MissingTexture>,
) {
    let mut stored = vec![];
    let missing_texture = missing_texture.get_single().unwrap();
    for handle in images.ids() {
        info!("{}", "------".green());
        info!("{handle:?} {:?}", missing_texture.0);
        if handle == missing_texture.0.id() {
            warn!("Early return");
            return;
        }
        stored.push(missing_texture_internal(
            &asset_server,
            &images,
            handle.clone(),
            missing_texture,
        ));
        info!("{}", "------".red());
    }

    for x in stored {
        let Some((mut handle, missing)) = x else {
            continue;
        };
        info!("{:?}", handle);
        handle = images.set(handle, missing);
    }
}

fn missing_texture_internal(
    asset_server: &AssetServer,
    images: &Assets<Image>,
    handle: HandleId,
    missing_texture: &MissingTexture,
) -> Option<(Handle<Image>, Image)> {
    info!("Event: {handle:?}");
    let loadstate = asset_server.get_load_state(handle.clone());
    match loadstate {
        LoadState::Failed => {
            info!("{}: {loadstate:?}", "Did Not Load Succesfully".red());
            let image = images.get(&missing_texture.0).unwrap();
            return Some((Handle::weak(handle), image.clone()));
        }
        _ => {
            info!("{}: {loadstate:?}", "Loaded Successfully".green());
        }
    };
    None
}
spare dirge
#

Why do you make the handle weak in missing_texture_internal?

river spire
#

because I can't get the strong I think right?

#

wait

spare dirge
#

If you have a handle, you can just clone it

river spire
#

I thought that made weak versions?

spare dirge
#

.clone() gives you the same strong/weak as you had iirc

#

.clone_weak() or whatever it was gives you a weak handle

#

Oh it might be because you pass around a HandleId, instead of Handle<Image>

river spire
#

ah I remember why I couldn't get the strong

#

because Assets<Images> gives you ids

spare dirge
#

What is the current output and what would you expect?

river spire
#
use bevy::asset::{HandleId, LoadState};
use bevy::prelude::*;
use colored::Colorize;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(
            Startup,
            (
                startup,
                missing_texture_startup,
                missing_texture_sprite,
                hold_handle,
            ),
        )
        .add_systems(PostUpdate, missing_texture.chain())
        .run();
}

fn startup(mut commands: Commands) {
    commands.spawn(Camera2dBundle::default());
}

#[derive(Component)]
struct HoldHandle(Handle<Image>);

fn missing_texture_sprite(mut commands: Commands, asset_server: Res<AssetServer>) {
    let handle = asset_server.load("missing_texture.png");
    commands.spawn(SpriteBundle {
        texture: handle.clone(),
        transform: Transform::from_xyz(0.0, 100.0, 0.0),
        ..Default::default()
    });
}

fn hold_handle(mut commands: Commands, asset_server: Res<AssetServer>) {
    let handle = asset_server.load("foo.png");
    commands.spawn(SpriteBundle {
        texture: handle.clone(),
        ..Default::default()
    });
    commands.spawn_empty().insert(HoldHandle(handle));
}

#[derive(Component)]
struct MissingTexture(Handle<Image>);

fn missing_texture_startup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn_empty().insert(MissingTexture(
        asset_server.load("textures/missing_texture.png"),
    ));
}

fn missing_texture(
    asset_server: Res<AssetServer>,
    mut image_event: EventReader<AssetEvent<Image>>,
    mut images: ResMut<Assets<Image>>,
    missing_texture: Query<&MissingTexture>,
) {
    let mut stored = vec![];
    let missing_texture = missing_texture.get_single().unwrap();
    for (handle, _) in images.iter() {
        info!("{}", "------".green());
        info!("{handle:?}\n{:?}", missing_texture.0);
        if handle == missing_texture.0.id() {
            warn!("Early return");
            return;
        }
        let mut strong = Handle::weak(handle);
        strong.make_strong(&images);
        stored.push(missing_texture_internal(
            &asset_server,
            &images,
            strong,
            missing_texture,
        ));
        info!("{}", "------".red());
    }

    for x in stored {
        let Some((mut handle, missing)) = x else {
            continue;
        };
        info!("{:?}", handle);
        handle = images.set(handle, missing);
    }
}

fn missing_texture_internal(
    asset_server: &AssetServer,
    images: &Assets<Image>,
    handle: Handle<Image>,
    missing_texture: &MissingTexture,
) -> Option<(Handle<Image>, Image)> {
    info!("Event: {handle:?}");
    let loadstate = asset_server.get_load_state(handle.clone());
    match loadstate {
        LoadState::Failed => {
            info!("{}: {loadstate:?}", "Did Not Load Succesfully".red());
            let image = images.get(&missing_texture.0).unwrap();
            return Some((handle, image.clone()));
        }
        _ => {
            info!("{}: {loadstate:?}", "Loaded Successfully".green());
        }
    };
    None
}
``` made it strong and it doesn't work still
#

the current output is NotLoaded for the LoadState

#

and I expect it to just replace the bad path Handle with the missing texture handle

spare dirge
#

Do you not hit the Early return? ๐Ÿค”

river spire
#

I do sometimes

#

I don't actually

#

that's a relic

#

weird

#

I'm removing it

#

it should've been continue

spare dirge
river spire
#

so I'll keep it actually

river spire
#

but yeah

#

it still doesn't update the thing

#

I only have one missing texture (I should have 2)

spare dirge
#

You have a textures/missing_texture, missing_texture and foo, does only the first one exist?

river spire
#

the second one exists

#

wait

#

that's maybe why it doesn't work

#

istg if this works now

#

it doesn't

#
use bevy::asset::{HandleId, LoadState};
use bevy::prelude::*;
use bevy::time::common_conditions::on_timer;
use bevy::utils::Duration;
use colored::Colorize;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(
            Startup,
            (
                startup,
                missing_texture_startup,
                missing_texture_sprite,
                hold_handle,
            ),
        )
        .add_systems(
            PostUpdate,
            missing_texture.run_if(on_timer(Duration::from_secs(1))),
        )
        .run();
}

fn startup(mut commands: Commands) {
    commands.spawn(Camera2dBundle::default());
}

#[derive(Component)]
struct HoldHandle(Handle<Image>);

fn missing_texture_sprite(mut commands: Commands, asset_server: Res<AssetServer>) {
    let handle = asset_server.load("missing_texture.png");
    commands.spawn(SpriteBundle {
        texture: handle.clone(),
        transform: Transform::from_xyz(0.0, 100.0, 0.0),
        ..Default::default()
    });
}

fn hold_handle(mut commands: Commands, asset_server: Res<AssetServer>) {
    let handle = asset_server.load("foo.png");
    commands.spawn(SpriteBundle {
        texture: handle.clone(),
        ..Default::default()
    });
    commands.spawn_empty().insert(HoldHandle(handle));
}

#[derive(Component)]
struct MissingTexture(Handle<Image>);

fn missing_texture_startup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands
        .spawn_empty()
        .insert(MissingTexture(asset_server.load("missing_texture.png")));
}

fn missing_texture(
    asset_server: Res<AssetServer>,
    mut image_event: EventReader<AssetEvent<Image>>,
    mut images: ResMut<Assets<Image>>,
    missing_texture: Query<&MissingTexture>,
) {
    let mut stored = vec![];
    let missing_texture = missing_texture.get_single().unwrap();
    for (handle, _) in images.iter() {
        info!("{}", "------".green());
        info!("{handle:?}\n{:?}", missing_texture.0);
        if handle == missing_texture.0.id() {
            warn!("Early return");
            continue;
        }
        let mut strong = Handle::weak(handle);
        strong.make_strong(&images);
        stored.push(missing_texture_internal(
            &asset_server,
            &images,
            strong,
            missing_texture,
        ));
        info!("{}", "------".red());
    }

    for x in stored {
        let Some((mut handle, missing)) = x else {
            continue;
        };
        info!("{:?}", handle);
        handle = images.set(handle, missing);
    }
}

fn missing_texture_internal(
    asset_server: &AssetServer,
    images: &Assets<Image>,
    handle: Handle<Image>,
    missing_texture: &MissingTexture,
) -> Option<(Handle<Image>, Image)> {
    info!("Event: {handle:?}");
    let loadstate = asset_server.get_load_state(handle.clone());
    match loadstate {
        LoadState::Failed => {
            info!("{}: {loadstate:?}", "Did Not Load Succesfully".red());
            let image = images.get(&missing_texture.0).unwrap();
            return Some((handle, image.clone()));
        }
        _ => {
            info!("{}: {loadstate:?}", "Loaded Successfully".green());
        }
    };
    None
}
``` updated
river spire
#

I'm gonna remove one of them

#

rq

#
use bevy::asset::{HandleId, LoadState};
use bevy::prelude::*;
use bevy::time::common_conditions::on_timer;
use bevy::utils::Duration;
use colored::Colorize;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, (startup, missing_texture_startup, hold_handle))
        .add_systems(
            PostUpdate,
            missing_texture.run_if(on_timer(Duration::from_secs(1))),
        )
        .run();
}

fn startup(mut commands: Commands) {
    commands.spawn(Camera2dBundle::default());
}

#[derive(Component)]
struct HoldHandle(Handle<Image>);

fn hold_handle(mut commands: Commands, asset_server: Res<AssetServer>) {
    let handle = asset_server.load("foo.png");
    commands.spawn(SpriteBundle {
        texture: handle.clone(),
        ..Default::default()
    });
    commands.spawn_empty().insert(HoldHandle(handle));
}

#[derive(Component)]
struct MissingTexture(Handle<Image>);

fn missing_texture_startup(mut commands: Commands, asset_server: Res<AssetServer>) {
    let handle = asset_server.load("missing_texture.png");
    commands.spawn(SpriteBundle {
        texture: handle.clone(),
        transform: Transform::from_xyz(0.0, 100.0, 0.0),
        ..Default::default()
    });
    commands.spawn_empty().insert(MissingTexture(handle));
}

fn missing_texture(
    asset_server: Res<AssetServer>,
    mut image_event: EventReader<AssetEvent<Image>>,
    mut images: ResMut<Assets<Image>>,
    missing_texture: Query<&MissingTexture>,
) {
    let mut stored = vec![];
    let missing_texture = missing_texture.get_single().unwrap();
    for (handle, _) in images.iter() {
        info!("{}", "------".green());
        info!("{handle:?}\n{:?}", missing_texture.0);
        if handle == missing_texture.0.id() {
            warn!("Early return");
            continue;
        }
        let mut strong = Handle::weak(handle);
        strong.make_strong(&images);
        stored.push(missing_texture_internal(
            &asset_server,
            &images,
            strong,
            missing_texture,
        ));
        info!("{}", "------".red());
    }

    for x in stored {
        let Some((mut handle, missing)) = x else {
            continue;
        };
        info!("{:?}", handle);
        handle = images.set(handle, missing);
    }
}

fn missing_texture_internal(
    asset_server: &AssetServer,
    images: &Assets<Image>,
    handle: Handle<Image>,
    missing_texture: &MissingTexture,
) -> Option<(Handle<Image>, Image)> {
    info!("Event: {handle:?}");
    let loadstate = asset_server.get_load_state(handle.clone());
    match loadstate {
        LoadState::Failed => {
            info!("{}: {loadstate:?}", "Did Not Load Succesfully".red());
            let image = images.get(&missing_texture.0).unwrap();
            return Some((handle, image.clone()));
        }
        _ => {
            info!("{}: {loadstate:?}", "Loaded Successfully".green());
        }
    };
    None
}
#

warning: `bevy_play` (bin "bevy_play") generated 4 warnings (run `cargo fix --bin "bevy_play"` to apply 3 suggestions)
    Finished dev [unoptimized + debuginfo] target(s) in 0.18s
     Running `target/x86_64-unknown-linux-gnu/debug/bevy_play`
2023-08-03T02:51:14.568650Z  INFO bevy_winit::system: Creating new window "Bevy App" (0v0)
2023-08-03T02:51:14.568877Z  INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1    
2023-08-03T02:51:14.984336Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce GTX 1660", vendor: 4318, device: 8580, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "530.41.03", backend: Vulkan }
2023-08-03T02:51:15.214873Z  WARN bevy_asset::asset_server: encountered an error while reading an asset: path not found: /run/media/Programming/CodingShit/Rust/Act4Scratch/bevy_play/assets/foo.png
2023-08-03T02:51:15.215412Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 23.11 NixOS", kernel: "6.1.31", cpu: "AMD Ryzen 5 3600XT 6-Core Processor", core_count: "6", memory: "31.3 GiB" }
2023-08-03T02:51:16.227288Z  INFO bevy_play: ------
2023-08-03T02:51:16.227348Z  INFO bevy_play: Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 12582963785223647243)
StrongHandle<Image>(AssetPathId(AssetPathId(SourcePathId(6538904967147923161), LabelId(8823233378563626002))))
2023-08-03T02:51:16.227376Z  INFO bevy_play: Event: StrongHandle<Image>(Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 12582963785223647243))
2023-08-03T02:51:16.227390Z  INFO bevy_play: Loaded Successfully: NotLoaded
2023-08-03T02:51:16.227406Z  INFO bevy_play: ------
2023-08-03T02:51:16.227416Z  INFO bevy_play: ------
2023-08-03T02:51:16.227423Z  INFO bevy_play: Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 7197727206600568209)
StrongHandle<Image>(AssetPathId(AssetPathId(SourcePathId(6538904967147923161), LabelId(8823233378563626002))))
2023-08-03T02:51:16.227431Z  INFO bevy_play: Event: StrongHandle<Image>(Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 7197727206600568209))
2023-08-03T02:51:16.227438Z  INFO bevy_play: Loaded Successfully: NotLoaded
2023-08-03T02:51:16.227443Z  INFO bevy_play: ------
2023-08-03T02:51:16.227449Z  INFO bevy_play: ------
2023-08-03T02:51:16.227453Z  INFO bevy_play: Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 13148262314052771789)
StrongHandle<Image>(AssetPathId(AssetPathId(SourcePathId(6538904967147923161), LabelId(8823233378563626002))))
2023-08-03T02:51:16.227460Z  INFO bevy_play: Event: StrongHandle<Image>(Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 13148262314052771789))
2023-08-03T02:51:16.227465Z  INFO bevy_play: Loaded Successfully: NotLoaded
2023-08-03T02:51:16.227471Z  INFO bevy_play: ------
2023-08-03T02:51:16.227476Z  INFO bevy_play: ------
2023-08-03T02:51:16.227481Z  INFO bevy_play: AssetPathId(AssetPathId(SourcePathId(6538904967147923161), LabelId(8823233378563626002)))
StrongHandle<Image>(AssetPathId(AssetPathId(SourcePathId(6538904967147923161), LabelId(8823233378563626002))))
2023-08-03T02:51:16.227491Z  WARN bevy_play: Early return
2023-08-03T02:51:16.227495Z  INFO bevy_play: ------
2023-08-03T02:51:16.227500Z  INFO bevy_play: Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 17983628420579414945)
StrongHandle<Image>(AssetPathId(AssetPathId(SourcePathId(6538904967147923161), LabelId(8823233378563626002))))
2023-08-03T02:51:16.227506Z  INFO bevy_play: Event: StrongHandle<Image>(Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 17983628420579414945))
2023-08-03T02:51:16.227512Z  INFO bevy_play: Loaded Successfully: NotLoaded
2023-08-03T02:51:16.227517Z  INFO bevy_play: ------
2023-08-03T02:51:16.444126Z  INFO bevy_window::system: No windows are open, exiting
2023-08-03T02:51:16.445064Z  INFO bevy_winit::system: Closing window 0v0```
 the log
#

everything is not loaded

#

this makes no sense

#

how is everything not loaded???

#

the strong handle literally exists

spare dirge
#

Might want to print AssetServer.get_handle_path(handle) for some extra debug info

#

And there is probably at least 1 loaded asset handle, which would be the one that is skipped from the early return

lyric moth
#

How many times is it printing this per tick? If the old handles stay around as components that never get removed...

river spire
#
2023-08-03T02:57:09.894769Z  INFO bevy_play: ------
2023-08-03T02:57:09.894819Z  INFO bevy_play: Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 1365765659312863716)
StrongHandle<Image>(AssetPathId(AssetPathId(SourcePathId(6538904967147923161), LabelId(8823233378563626002))))
2023-08-03T02:57:09.894843Z  INFO bevy_play: HANDLE INFO: None
2023-08-03T02:57:09.894858Z  INFO bevy_play: Event: StrongHandle<Image>(Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 1365765659312863716))
2023-08-03T02:57:09.894872Z  INFO bevy_play: Loaded Successfully: NotLoaded
2023-08-03T02:57:09.894883Z  INFO bevy_play: ------
2023-08-03T02:57:09.894891Z  INFO bevy_play: ------
2023-08-03T02:57:09.894897Z  INFO bevy_play: Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 4158536864569914776)
StrongHandle<Image>(AssetPathId(AssetPathId(SourcePathId(6538904967147923161), LabelId(8823233378563626002))))
2023-08-03T02:57:09.894906Z  INFO bevy_play: HANDLE INFO: None
2023-08-03T02:57:09.894911Z  INFO bevy_play: Event: StrongHandle<Image>(Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 4158536864569914776))
2023-08-03T02:57:09.894918Z  INFO bevy_play: Loaded Successfully: NotLoaded
2023-08-03T02:57:09.894925Z  INFO bevy_play: ------
2023-08-03T02:57:09.894934Z  INFO bevy_play: ------
2023-08-03T02:57:09.894942Z  INFO bevy_play: AssetPathId(AssetPathId(SourcePathId(6538904967147923161), LabelId(8823233378563626002)))
StrongHandle<Image>(AssetPathId(AssetPathId(SourcePathId(6538904967147923161), LabelId(8823233378563626002))))
2023-08-03T02:57:09.894954Z  INFO bevy_play: HANDLE INFO: Some(AssetPath { path: "missing_texture.png", label: None })
2023-08-03T02:57:09.894966Z  WARN bevy_play: Early return
2023-08-03T02:57:09.894971Z  INFO bevy_play: ------
2023-08-03T02:57:09.894980Z  INFO bevy_play: Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 10474714813496361804)
StrongHandle<Image>(AssetPathId(AssetPathId(SourcePathId(6538904967147923161), LabelId(8823233378563626002))))
2023-08-03T02:57:09.894991Z  INFO bevy_play: HANDLE INFO: None
2023-08-03T02:57:09.894999Z  INFO bevy_play: Event: StrongHandle<Image>(Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 10474714813496361804))
2023-08-03T02:57:09.895008Z  INFO bevy_play: Loaded Successfully: NotLoaded
2023-08-03T02:57:09.895018Z  INFO bevy_play: ------
2023-08-03T02:57:09.895027Z  INFO bevy_play: ------
2023-08-03T02:57:09.895035Z  INFO bevy_play: Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 13148262314052771789)
StrongHandle<Image>(AssetPathId(AssetPathId(SourcePathId(6538904967147923161), LabelId(8823233378563626002))))
2023-08-03T02:57:09.895047Z  INFO bevy_play: HANDLE INFO: None
2023-08-03T02:57:09.895054Z  INFO bevy_play: Event: StrongHandle<Image>(Id(6ea26da6-6cf8-4ea2-9986-1d7bf6c17d6f, 13148262314052771789))
2023-08-03T02:57:09.895064Z  INFO bevy_play: Loaded Successfully: NotLoaded
2023-08-03T02:57:09.895074Z  INFO bevy_play: ------
2023-08-03T02:57:10.494347Z  INFO bevy_window::system: No windows are open, exiting
2023-08-03T02:57:10.495263Z  INFO bevy_winit::system: Closing window 0v0
``` one tick
spare dirge
#

Huh, 4 non-missingtextures per tick? That's odd, you only have 2 assets around ๐Ÿค”

river spire
#

I think it's counting the sprites

#

that doesn't make sense to me still

#

there's 5 blocks

#

there is holdhandle, missingtexture, spritebundle, spritebundle

#

wait the camera

#

but that doesn't make sense

#

wait I have Image from the loop

#

could I just overwrite that

#

but that's silly to me kinda

#

because it's still NotLoaded

#

so it wouldn't work

#

as far fetched as that is to me

spare dirge
#

Okay so it's definitely related to looping trough the assets

river spire
#

why do you say that

spare dirge
#

I tested the code, replaced the loop over assets with a resource that holds all handles that need to get checked

#

And it works

river spire
#

what the fuck

#

Assets<Image> is bad

#

confirmed

#

is there a reason why Assets<Image> doesn't work?

#

does Assets<Image> not hold Failed things or something?

#

this makes no sense

spare dirge
#

I think Assets<Image> might give a different handle to the same asset somehow

#

There's two types of handles after all, AssetPathIds and Uuids

river spire
#

It's giving both in the logs

#

let me try and replicate your findings rq

#

can you show your code? @spare dirge

spare dirge
#

Sure, let me just fix a bug real quick

river spire
#

thumbs_up thank you

spare dirge
#

I said a bug but I apparantly called the folder asset instead of assets ๐Ÿ˜‚

river spire
#

haha

#

omg

#

that works

#

thank you so much

spare dirge
#

It's definitely a bit shorter yes. Should also be more efficient, need that super_bevy performance after all

river spire
#

I should probably turn this into a library

#

I don't want anyone to feel my pain

spare dirge
#

It could still be improved further tho, by not copying the missing texture a million times, but I doubt missing assets are gonna be common ๐Ÿ˜‚

river spire
#

agreed