Skip to content

Commit 6bf610d

Browse files
Update Application component to display loading progression and adjust initial mount state
1 parent 29b8d5c commit 6bf610d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

testing/src/application.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { Fragment, useState } from "react";
22
import { Unity, useUnityContext } from "../../module/source/exports";
33

44
export function Application() {
5-
const [isMounted, setIsMounted] = useState(false);
5+
const [isMounted, setIsMounted] = useState(true);
66

7-
const { unityProvider } = useUnityContext({
7+
const { unityProvider, loadingProgression } = useUnityContext({
88
codeUrl: `/unity-build/unity.wasm`,
99
dataUrl: `/unity-build/unity.data`,
1010
frameworkUrl: `/unity-build/unity.framework.js`,
@@ -17,10 +17,12 @@ export function Application() {
1717
<button onClick={() => setIsMounted((prev) => !prev)}>
1818
{isMounted ? "Unmount Unity" : "Mount Unity"}
1919
</button>
20+
<p>Loading Progression: {loadingProgression}%</p>
21+
<br />
2022
{isMounted && (
2123
<Unity
2224
unityProvider={unityProvider}
23-
style={{ width: 400, height: 250 }}
25+
style={{ width: 400, height: 350 }}
2426
/>
2527
)}
2628
</Fragment>

0 commit comments

Comments
 (0)