#Why doesn't it create the handle at all?
171 messages ยท Page 1 of 1 (latest)
What does " it just doesn't create the handle" mean
if it can't find the path it doesn't create the handle
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
Is it crashing?
no
not anymore
updated the code
I accidentally deleted the code
thanks discord
I don't know how
๐ซ
And this is continuously printing statements each frame right? It never prints green?
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
Does the state just flip to NotLoaded or does it ever become Unloaded?
it always prints NotLoaded
it gets the missing texture thing as loaded but the other one is not loaded
And there is an /assets/textures/foo.png file in your cargo project directory?
no
the point is there's not supposed to be
I'm trying to inject a handle if there is no file
I don't I think I do ๐
So at what point are you trying to get the missing texture, that you expect to exist already, and doesn't?
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
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
Oh, HoldHandle is a Component
I'm unsure then, my test came back with them Failing just fine
what was your test?
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
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
If you load you always get a non-blank Handle
but the load failud
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
Are any of the code snippets still up-to-date?
after reading the docs, I think you need to do rs x.1 = images.set(x.0, x.1);
that looks cursed but I will try I guess
This is the correct way to set the data for an asset I think
Whats with the unnamed tuple fields tho, give them a name :')
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
I don't think this would work
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
}
Why do you make the handle weak in missing_texture_internal?
If you have a handle, you can just clone it
I thought that made weak versions?
.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>
What is the current output and what would you expect?
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
Do you not hit the Early return? ๐ค
I do sometimes
I don't actually
that's a relic
weird
I'm removing it
it should've been continue
It wouldn't really change the handle, just give it a different image
so I'll keep it actually
that's what I want yeah
but yeah
it still doesn't update the thing
I only have one missing texture (I should have 2)
You have a textures/missing_texture, missing_texture and foo, does only the first one exist?
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
missing_texture and missing_texture should exist
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
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
How many times is it printing this per tick? If the old handles stay around as components that never get removed...
it prints 4 things per tick
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
Huh, 4 non-missingtextures per tick? That's odd, you only have 2 assets around ๐ค
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
could this be related to https://github.com/bevyengine/bevy/issues/9337
as far fetched as that is to me
Okay so it's definitely related to looping trough the assets
why do you say that
I tested the code, replaced the loop over assets with a resource that holds all handles that need to get checked
And it works
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
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
It's giving both in the logs
let me try and replicate your findings rq
can you show your code? @spare dirge
Sure, let me just fix a bug real quick
thank you
that's so much cleaner than what I have
haha
omg
that works
thank you so much
It's definitely a bit shorter yes. Should also be more efficient, need that
performance after all
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 ๐
agreed