How to access Resource in an async task? #11251
Unanswered
feelingsonice
asked this question in
Q&A
Replies: 1 comment 2 replies
-
The only safe way to do this that I can think of is to wrap the contents of your Just keep in mind that a |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a procedural generation task that may take a long time to complete so I've create a plugin to listen for an
Event
trigger. The task requires access to certainResource
stored as either anAsset
resource or plainResource
. This means I only have borrowed access to it AFAIK since Bevy stores and owns it.I'd really rather not clone this
Resource
. Ideally, this event listener is able retrieve some sort of reference to it, pass it to the async task (I'm usingAsyncComputeTaskPool
), and that's it. However, I can't send theRes
via theEvent
as there's lifetime issues, and I'm also not seeing a easy way to pass it into the async task.Anyone have suggestions?
Beta Was this translation helpful? Give feedback.
All reactions