You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Struggling a bit with the Resources container from legion. I want to store terrain heightmap as part of resources, so it is a significant chunk of data. Was just thinking I could create the following struct:
structGame{world:World,resources:Resources,}
And then create a new instance of Game in a separate thread and send it back to the main thread (with thread::spawn and mpsc channels). Basically so I do not block the main UI thread while the game is starting up or being loaded from disk.
But digging in the code I see Resources is actually explicitly marked as not !Send in legion code:
_not_send_sync:PhantomData<*const u8>,
So that does not seem to be an option. Also Resources::insert() consumes the value, so I am really puzzled how can I implement loading of resources in a separate thread here, without resorting to copying and cloning data around.
Any hints or best practices or good examples for Resources usage?
The text was updated successfully, but these errors were encountered:
Struggling a bit with the
Resources
container from legion. I want to store terrain heightmap as part of resources, so it is a significant chunk of data. Was just thinking I could create the following struct:And then create a new instance of Game in a separate thread and send it back to the main thread (with
thread::spawn
andmpsc
channels). Basically so I do not block the main UI thread while the game is starting up or being loaded from disk.But digging in the code I see
Resources
is actually explicitly marked as not!Send
in legion code:So that does not seem to be an option. Also
Resources::insert()
consumes the value, so I am really puzzled how can I implement loading of resources in a separate thread here, without resorting to copying and cloning data around.Any hints or best practices or good examples for
Resources
usage?The text was updated successfully, but these errors were encountered: