Multi threading support

Discussion and help for Easy Save 3

Multi threading support

Postby teq » Tue Sep 17, 2019 2:48 pm

In ES3Settings file i changed "return Application.persistentDataPath + "/" + path;" to "return ES3.persistentDataPath + "/" + path;"
and "return Application.dataPath + "/" + path;" to "return ES3.dataPath + "/" + path;".
In ES3 file added
Code: Select all
public static string persistentDataPath = Application.persistentDataPath;
   public static string dataPath = Application.dataPath;


Same change also need to be done in GetPath file, line with "if(directoryPath != UnityEngine.Application.persistentDataPath)"

It can be used in another threads now. Please, add this to the next version.
teq
 
Posts: 3
Joined: Mon Jul 16, 2018 12:23 pm

Re: Multi threading support

Postby Joel » Tue Sep 17, 2019 5:35 pm

Hi there,

I wasn't aware that Application.persistentDataPath wasn't thread safe, as we've been told that it essentially works as your solution proposes underneath. Would you be able to point me towards where it says it isn't thread safe?

All the best,
Joel
Joel Tebbett @ Moodkie Interactive
Twitter - Unity - LinkedIn
User avatar
Joel
Moodkie Staff
 
Posts: 2476
Joined: Wed Nov 07, 2012 10:32 pm

Re: Multi threading support

Postby teq » Tue Sep 17, 2019 7:16 pm

It's from asset https://assetstore.unity.com/packages/t ... ding-20857. I don't know, how it behaves with "native" threading.

get_persistentDataPath can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
teq
 
Posts: 3
Joined: Mon Jul 16, 2018 12:23 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron