autoSyncPersistentDataPath parameter support #567
Closed
Bart-Verdonck
started this conversation in
Feature Requests
Replies: 2 comments
-
A release with included support will be published next week. Thanks for your suggestion! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi! This feature has been released in update! v9.7.0 including updated docs. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There's been a fix for an issue with synchronizing the IndexedDB From issue tracker:
Fixed in 2021.3.44f1, 2022.3.44f1, 6000.0.11f1 (search for "IndexedDB" in release notes)
Fixed an issue that Application.persistentDataPath would not automatically persist, by adding a new JS config option
autoSyncPersistentDataPath: true
to enable automatic synchronization of Application.persistentDataPath over to IndexedDB.This option is found in the Builds Index.html file, uncomment it and refresh the running build page and the issue will be resolved.
To use this new setting, you can modify the web templates provided by Unity for each installation you want this behavior in. Or better yet, make it team-shared by adding a custom web template in Assets/WebGLTemplates in your project. Whatever you choose, add autoSyncPersistentDataPath: true, into the config that's passed into createUnityInstance() in the template's index.html.
The description for the new config from the docs:
autoSyncPersistentDataPath: true
If set to true, all file writes inside the Unity Application.persistentDataPath directory automatically persist so that the contents are remembered when the user revisits the site the next time. If unset (or set to false), you must manually sync file modifications inside the Application.persistentDataPath directory by calling the JS_FileSystem_Sync() JavaScript function.
It's unset (disabled) by default to not break existing projects. See
<Unity Install Location>\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\WebGLTemplates\Default\index.html
for the explanation:// config.autoSyncPersistentDataPath = true;
This autosyncing is currently not the default behavior to avoid regressing existing user projects that might rely on the earlier manual JS_FileSystem_Sync() behavior, but in future Unity version, this will be expected to change.
Beta Was this translation helpful? Give feedback.
All reactions