I would like to do something like this:
for (int i = 0; i < array.Length; i++)
{
var s = do the loading then continue iteration
}
Should I do this with a coroutine or maybe async? Can anyone give a simple example?
I would like to do something like this:
for (int i = 0; i < array.Length; i++)
{
var s = do the loading then continue iteration
}
Should I do this with a coroutine or maybe async? Can anyone give a simple example?
Or just do it? Or try all three? Immediate, async and coroutine… It’s not a huge change, feels super easy to test.
I’d use async to load and deserialize files, you can use multithreading for those tasks without freezing the main thread and async is just very convenient when interfacing with multithreading
I agree you should just try them all to see what you like, but the general rule of thumb should be “if this needs to be synchronized with the framerate, use a Coroutine, otherwise, use an async (even if on some platforms it amounts to the same thing).”