Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions module/source/hooks/use-unity-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const useUnityLoader = (unityConfig: UnityConfig): UnityLoaderStatus => {
// this scenario, the window is not available. We can't create a Unity
// Loader in this case.
if (isBrowserEnvironment === false) {
return;
return undefined;
}
// If the script's source is null, we'll reset the status to idle.
if (unityConfig.loaderUrl === null) {
setStatus(UnityLoaderStatus.Idle);
return;
return undefined;
}
/**
* Find existing script element by source. It may have been added by
Expand Down Expand Up @@ -78,7 +78,7 @@ const useUnityLoader = (unityConfig: UnityConfig): UnityLoaderStatus => {
if (script !== null) {
script.removeEventListener("load", setStateFromEvent);
script.removeEventListener("error", setStateFromEvent);
window.document.body.removeChild(script);
script.remove();
}
};
}, [unityConfig.loaderUrl]);
Expand Down
Loading