bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Improvement of AssetServer::load documentation to help find a way to load from file with hash in filename

Open bugsweeper opened this issue 1 year ago • 4 comments

Objective

  • Fixes #13192 .
  • It is not possible to specify the path of the file and the subasset in it in one string slice, if there is a hash in the file name, because hash is separator between filename and subasset, so they must be separated explicitly

Solution

  • Improved documentation for AssetServer::load.

bugsweeper avatar May 07 '24 11:05 bugsweeper

@alice-i-cecile I used From<(Path, label)> because AssetServer::load uses Into<AssetPath> in arguments. If you prefer constructor there is a way (more complex, but exists) for such thing: asset_server.load(AssetPath::from_path(Path::new("A#.ron")).with_label("Scene0")); I proposed simplier way: asset_server.load((Path::new("A#.ron"), "Scene0")); I agree that documenting should be done, I could add this way of loading into AssetServer::load doc-comment. If this is bad idea we can close this PR and parent issue, because constructor way already exists.

bugsweeper avatar May 08 '24 09:05 bugsweeper

May be we should improve just AssetServer::load doc-comment with explicit path and label example

bugsweeper avatar May 08 '24 09:05 bugsweeper

May be we should improve just AssetServer::load doc-comment with explicit path and label example

Great idea :) That's definitely my preference.

alice-i-cecile avatar May 08 '24 14:05 alice-i-cecile

@alice-i-cecile Is there anything else I could do to move forward?

bugsweeper avatar May 17 '24 07:05 bugsweeper