mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 15:14:50 +00:00
Add reserve_handle
to Assets
. (#10939)
# Objective Fixes #10938. ## Solution Adds `reserve_handle` to `Assets`. --- ## Changelog - Added `reserve_handle` to `Assets`.
This commit is contained in:
parent
a795de30b4
commit
da485c29b3
1 changed files with 5 additions and 0 deletions
|
@ -299,6 +299,11 @@ impl<A: Asset> Assets<A> {
|
|||
self.handle_provider.clone()
|
||||
}
|
||||
|
||||
/// Reserves a new [`Handle`] for an asset that will be stored in this collection.
|
||||
pub fn reserve_handle(&self) -> Handle<A> {
|
||||
self.handle_provider.reserve_handle().typed::<A>()
|
||||
}
|
||||
|
||||
/// Inserts the given `asset`, identified by the given `id`. If an asset already exists for `id`, it will be replaced.
|
||||
pub fn insert(&mut self, id: impl Into<AssetId<A>>, asset: A) {
|
||||
let id: AssetId<A> = id.into();
|
||||
|
|
Loading…
Reference in a new issue