bevyengine / bevyengine/bevy

Ability to opt-out of asset garbage collection per asset type

Open
#9,628 2 comments 0 reactions 0 assignees View on GitHub
A-Assets C-Usability
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?

For simple apps and/or asset types, game developers might want to always keep all of their assets of a certain type loaded, to be able to `iter` over all of them. I've come across this want a few times.

## What solution would you like?

If `Asset` is required to be `derive`'d / manually implemented, then there could be an attribute for it:

```rust
#[derive(Asset)]
#[asset(no_gc)]
struct MyAsset {
// ...
}
```

## What alternative(s) have you considered?

The current easiest alternative is to create a resource that holds handles to all assets of a given type:

```rust
#[derive(Resource)]
struct MyAssets(Vec>);
```

And add to this resource whenever an asset gets loaded.

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.