bevyengine / bevyengine/bevy

Allow "named" assets and overriding "names"

Open
#1,810 5 comments 0 reactions 0 assignees View on GitHub
A-Assets C-Usability S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

Currently only assets loaded by AssetServer::load have names and it's fixed as the name of the path. Looking up a loaded assets is as simple as calling load a second time. However assets that are created don't have this luxury thus requiring custom cataloging of handles to provide lookup.

## What solution would you like?

Add new methods
```rust
AssetServer::get_handle_by_name(name: &str) -> Option>;
Assets::get_handle_by_name(name: &str) -> Option>;
Assets::add_as(name: &str, asset: T) -> Handle;
```

## What alternative(s) have you considered?

Adding custom catalog for assets. This while doable seems like an anti-pattern as all handles will need to be cloned into the catalog.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.