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 bf37c06 commit 58bd8c2Copy full SHA for 58bd8c2
module/source/hooks/use-unity-loader.ts
@@ -70,7 +70,6 @@ const useUnityLoader = (unityConfig: UnityConfig): UnityLoaderStatus => {
70
script.src = loaderUrl;
71
script.async = true;
72
script.setAttribute("data-status", "loading");
73
- document.body.appendChild(script);
74
75
// Define load handler.
76
const handleLoad = () => {
@@ -98,6 +97,9 @@ const useUnityLoader = (unityConfig: UnityConfig): UnityLoaderStatus => {
98
97
script.addEventListener("load", handleLoad);
99
script.addEventListener("error", handleError);
100
+ // Append the script to the document body.
101
+ document.body.appendChild(script);
102
+
103
// Initialize the reference map.
104
scriptReferenceMap.set(loaderUrl, {
105
count: 1,
0 commit comments