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");