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 };