File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -179,13 +179,14 @@ const useUnityContext = (unityConfig: IUnityConfig): IUnityContextHook => {
179
179
// Re-attaches the canvas to the body element of the document. This way it
180
180
// wont be removed from the DOM when the component is unmounted. Then the
181
181
// canvas will be hidden while it is being unloaded.
182
- document . body . appendChild ( unityInstance . Module . canvas as Node ) ;
183
- unityInstance . Module . canvas . style . display = "none" ;
182
+ const canvas = unityInstance . Module . canvas as HTMLCanvasElement ;
183
+ document . body . appendChild ( canvas ) ;
184
+ canvas . style . display = "none" ;
184
185
// Unloads the Unity Instance.
185
186
await unload ( ) ;
186
187
// Eventually the canvas will be removed from the DOM. This has to be done
187
188
// manually since the canvas is no longer controlled by the React DOM.
188
- unityInstance . Module . canvas . remove ( ) ;
189
+ canvas . remove ( ) ;
189
190
} ,
190
191
[ unityInstance ]
191
192
) ;
You can’t perform that action at this time.
0 commit comments