From 05cf60fa7dbb3dec9fc75733fa174d2ba2e6d7dc Mon Sep 17 00:00:00 2001 From: Isao Jonas Date: Wed, 26 Jan 2022 15:38:42 -0600 Subject: [PATCH] fix canvas event reference fix a regression introduced in bec2c654acdd5954527482882e1ea2f6f32c6429, where the canvas event was dispatched with the react ref, rather than the underlying canvas value. --- source/components/unity.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/components/unity.ts b/source/components/unity.ts index 0402e21a..c034d87a 100644 --- a/source/components/unity.ts +++ b/source/components/unity.ts @@ -66,8 +66,8 @@ export function Unity(props: IUnityProps): ReactElement { // When the application is loaded, we'll send over a reference to the // canvas element. When the HTML Canvas Element ref is defined, an event // will be dispatched. - if (htmlCanvasElement !== null) { - unityContext.dispatchEvent("canvas", htmlCanvasElement); + if (htmlCanvasElement.current !== null) { + unityContext.dispatchEvent("canvas", htmlCanvasElement.current); } // The loaded event is dispatched. unityContext.dispatchEvent("loaded");