Async--not an es3 issue

Discussion and help for Easy Save 3
Post Reply
Notso
Posts: 51
Joined: Sat May 08, 2021 6:53 pm

Async--not an es3 issue

Post by Notso »

This is more of a general coding issue thought I would ask see if anyone might have an answer (or am I doing wrong?)...

I have a trigger to kick off my save, there is a 1 sec pause in gameplay while it saves. I thought async would be a better way,. take it off the main thread.

So I use ontrigger it fires off (I made it a task to get the debug to fire when it was done)

Code: Select all

 public async void Save()
    {
       await SaveAsync();
       Debug.Log("Saving Has Been Completed");
    }
Then the actual task

Code: Select all

private async Task SaveAsync()
{
//save code here
await Task.CompletedTask;
}
I did just originally have the async void save and it still paused as well.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Async--not an es3 issue

Post by Joel »

Hi there,

If you're not used to using Async I would strongly avoid using it as concurrency isn't trivial, and you will need to ensure that all of your save data and everything around it is thread safe. 99.9% of the time going async isn't the answer in my experience (this is why we intentionally don't include any concurrency in Easy Save).

If you're having performance issues you should use caching instead, which we happen to be talking about in a different thread :)
https://docs.moodkie.com/easy-save-3/es ... rformance/

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply