We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 099191a commit 0758722Copy full SHA for 0758722
source/hooks/use-unity-instance.ts
@@ -41,6 +41,12 @@ export function useUnityInstance(
41
// Creates the Unity Instance, this method is made available globally by
42
// the Unity Loader.
43
try {
44
+ // It is possible for the application being rendered server side. In
45
+ // this scenario, the window is not available. We can't create the
46
+ // Unity Instance in this case.
47
+ if (window === undefined) {
48
+ return;
49
+ }
50
const unityInstance = await window.createUnityInstance(
51
htmlCanvasElement,
52
unityInstanceParameters,
0 commit comments