-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Bevy version
0.12.1
Also tested on commit hash: 41c3620
Relevant system information
Dell Precision 7670
Windows 11 Enterprise (10.0.22621 Build 22621)
What you did
I've been trying to load assets from absolute file paths (I'm making a small GLTF viewer which does not come pre-packaged with its models). Loading with asset_server.load() (where asset_server is Res) worked okay in Bevy 0.11 but in 0.12 I hit problems.
For example:
commands.spawn((
SceneBundle {
// scene: asset_server.load(r"C:\Users\user\my-proj\assets\models\model.glb#Scene0"), // throws error
scene: asset_server.load(r"models\model.glb#Scene0"), // works!
..default()
},
ModelInstance {},
));
I also tested this against absolute paths provided from drag-and-drop events.
What went wrong
I expected the two load() lines above to be equivalent, but if I use the one with the absolute path I get the following error and my application panics:
thread 'Compute Task Pool (15)' panicked at C:\Users\koceom0\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_asset-0.12.0\src\path.rs:458:70:
called `Result::unwrap()` on an `Err` value: InvalidSourceSyntax
I don't see anything about this specifically in the migration guide, so I'm assuming this is not expected behaviour.
Additional information
I was able to work around this issue by using the pathdiff crate to convert the absolute path into one which is relative to the current working directory. With this work-around it seems I'm able to load assets from anywhere on the system, confirming for me that issue above is not an access one.