Skip to content

Commit

Permalink
Added new hooks to context hook typings
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreylanters committed Oct 20, 2024
1 parent 74e63b8 commit 7931373
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions module/source/types/unity-context-hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ type UnityContextHook = EventSystemHook & {
* @returns A promise that resolves when the UnityInstance has been unloaded.
*/
readonly unload: () => Promise<void>;

/**
* 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<void>;
};

export type { UnityContextHook };

0 comments on commit 7931373

Please sign in to comment.