From 7931373d3d46f99d9872c0511b18c797d0ad6153 Mon Sep 17 00:00:00 2001 From: Jeffrey Lanters Date: Sun, 20 Oct 2024 15:01:53 +0200 Subject: [PATCH] Added new hooks to context hook typings --- module/source/types/unity-context-hook.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/module/source/types/unity-context-hook.ts b/module/source/types/unity-context-hook.ts index 64a65b5..4cd3f7e 100644 --- a/module/source/types/unity-context-hook.ts +++ b/module/source/types/unity-context-hook.ts @@ -88,6 +88,19 @@ type UnityContextHook = EventSystemHook & { * @returns A promise that resolves when the UnityInstance has been unloaded. */ readonly unload: () => Promise; + + /** + * Detatches the Unity Instance from the React DOM, by doing so, the Unity + * Instance can be unloaded from the memory while the Unity component can be + * unmounted safely. + * + * Warning! This is a workaround for the fact that the Unity WebGL instances + * which are build with Unity 2021.2 and newer cannot be unmounted before the + * Unity Instance is unloaded. + * @see https://github.com/jeffreylanters/react-unity-webgl/issues/22 + * @returns A promise that resolves when the UnityInstance has been detached. + */ + readonly UNSAFE__detachAndUnloadImmediate: () => Promise; }; export type { UnityContextHook };