Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Assets/WebGLTemplates/SequenceReact/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>Sequence Unity Demo</title>
</head>
<body>
<div id="root"></div>
Expand Down
5 changes: 1 addition & 4 deletions Assets/WebGLTemplates/SequenceReact/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

.container {
position: relative;
/* The container determains the size. */
width: 800px;
height: 600px;
}

.container > .loading-overlay {
Expand All @@ -20,7 +17,7 @@
left: 0;
width: 100%;
height: 100%;
background: grey;
background: #1a1a1a;
/* We'll set the following Flex properties in order to center the text. */
display: flex;
justify-content: center;
Expand Down
20 changes: 20 additions & 0 deletions Assets/WebGLTemplates/SequenceReact/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ import "./App.css";

useEffect(() => {
addEventListener("GoogleSignIn", handleGoogleSignIn);
window.addEventListener("resize", handleResize);
handleResize()
return () => {
removeEventListener("GoogleSignIn", handleGoogleSignIn);
window.removeEventListener("resize", handleResize);
};
}, []);

Expand All @@ -68,6 +71,23 @@ import "./App.css";
setShowLogin(false);
};

const handleResize = () => {
const container = document.querySelector('.container') as any;

let w = window.innerWidth * 0.98;
let h = window.innerHeight * 0.98;

const r = 600 / 960;
if (w * r > window.innerHeight) {
w = Math.min(w, Math.ceil(h / r));
}

h = Math.floor(w * r);

container.style.width = w + "px";
container.style.height = h + "px";
}

return (
<div className="outer-container">
<div className="container">
Expand Down
2 changes: 1 addition & 1 deletion Assets/WebGLTemplates/SequenceReact/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
background-color: #1a1a1a;

font-synthesis: none;
text-rendering: optimizeLegibility;
Expand Down
Binary file added Demo/Build/Demo.data
Binary file not shown.
5 changes: 5 additions & 0 deletions Demo/Build/Demo.framework.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Demo/Build/Demo.loader.js

Large diffs are not rendered by default.

Binary file added Demo/Build/Demo.wasm
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Keys":["com.unity.services.core.version"],"Values":[{"m_Value":"1.4.0","m_IsReadOnly":true}]}
13 changes: 13 additions & 0 deletions Demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sequence Unity Demo</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
25 changes: 25 additions & 0 deletions Demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "react-unity-webgl-demo",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite --port 4444",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@react-oauth/google": "^0.12.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-unity-webgl": "^9.5.2"
},
"devDependencies": {
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@vitejs/plugin-react": "^4.2.1",
"typescript": "^5.2.2",
"vite": "^5.2.0"
}
}
Loading
Loading