Skip to content

Commit 7931373

Browse files
Added new hooks to context hook typings
1 parent 74e63b8 commit 7931373

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

module/source/types/unity-context-hook.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,19 @@ type UnityContextHook = EventSystemHook & {
8888
* @returns A promise that resolves when the UnityInstance has been unloaded.
8989
*/
9090
readonly unload: () => Promise<void>;
91+
92+
/**
93+
* Detatches the Unity Instance from the React DOM, by doing so, the Unity
94+
* Instance can be unloaded from the memory while the Unity component can be
95+
* unmounted safely.
96+
*
97+
* Warning! This is a workaround for the fact that the Unity WebGL instances
98+
* which are build with Unity 2021.2 and newer cannot be unmounted before the
99+
* Unity Instance is unloaded.
100+
* @see https://github.com/jeffreylanters/react-unity-webgl/issues/22
101+
* @returns A promise that resolves when the UnityInstance has been detached.
102+
*/
103+
readonly UNSAFE__detachAndUnloadImmediate: () => Promise<void>;
91104
};
92105

93106
export type { UnityContextHook };

0 commit comments

Comments
 (0)