Skip to content

Commit ce340ec

Browse files
Added support for automatically Syncing the Persistent Data Path
1 parent e7ee5ad commit ce340ec

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

module/source/hooks/use-unity-arguments.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ const useUnityArguments = (unityProps: UnityProps): UnityArguments => {
4848
// value of `1` will be used.
4949
devicePixelRatio: unityProps.devicePixelRatio || 1,
5050

51+
// Assigns the auto sync persistent data path value to the Unity arguments
52+
// object. If the auto sync persistent data path value is not defined via
53+
// the Unity Props, the default value of `undefined` will be used.
54+
autoSyncPersistentDataPath: unityProps.autoSyncPersistentDataPath,
55+
5156
// Assigns the match WebGL to canvas size value to the Unity arguments
5257
// object. If the match WebGL to canvas size value is not defined via the
5358
// Unity Props, the default value of `true` will be used.

module/source/types/unity-arguments.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,16 @@ type UnityArguments = {
8181
*/
8282
readonly devicePixelRatio?: number;
8383

84+
/**
85+
* If set to true, all file writes inside the Unity Application
86+
* persistentDataPath directory automatically persist so that the contents are
87+
* remembered when the user revisits the website the next time. If unset (or
88+
* set to false), you must manually sync file modifications inside the
89+
* Application persistentDataPath directory by calling the
90+
* JS_FileSystem_Sync() JavaScript function.
91+
*/
92+
readonly autoSyncPersistentDataPath?: boolean;
93+
8494
/**
8595
* When disabling the match WebGL to canvas size flag, the canvas allows for
8696
* client side customization of the WebGL canvas target size instead of

module/source/types/unity-props.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { UnityArguments } from "./unity-arguments";
99
*/
1010
type ConfigurableUnityArguments = Pick<
1111
UnityArguments,
12-
"devicePixelRatio" | "matchWebGLToCanvasSize" | "disabledCanvasEvents"
12+
| "devicePixelRatio"
13+
| "matchWebGLToCanvasSize"
14+
| "disabledCanvasEvents"
15+
| "autoSyncPersistentDataPath"
1316
>;
1417

1518
/**

0 commit comments

Comments
 (0)