- Home /
Host Unity Game on Google Sites
I have created a WebGL game that is actually kind of fun, and want to put it on a new Google Site. I know hosting on Google Drive has been taken down, but I feel there must be some way to embed an HTML page on Google Drive in Google Sites. But Google Sites tells me the selected file type is not supported. When I try using a URL embed, it shows the HTML code instead of the page. If I use a direct URL, it tells me a link will be displayed instead of the actual HTML. How do I embed a Unity game in Google Sites?
I have searched for this before, but all the answers either use the deprecated Web Player, old Google Sites, or deprecated Google Drive Hosting.
(I am using NEW Google Sites, not old Google Sites)
Answer by orethoion · Oct 11, 2017 at 09:04 AM
Since the new Google Sites stopped supporting gadgets, the best alternative would be to insert a url that can be expanded to a mini preview of sorts. The requirements for that would be
Free
Customizable
Supports: HTML5 (Canvas), Javascript, CSS
File Hosting
No random overlays/icons/footers
Uses HTTPS (since otherwise google won’t let you have a preview)
After trying a few different web hosting services (wordpress, weebly, neocities, etc), I found that Github Pages was by far the best option. Just create a repo named [username].github.io and put your build in it, then link the url to your Google Sites page.
A few modifications to index.html a bit to make it fullscreen:
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> Unity WebGL Player | thing </title>
<link rel="shortcut icon" href="TemplateData/favicon.ico">
<style>
html {
overflow: hidden;
}
#gameContainer {
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="TemplateData/style.css">
<script src="TemplateData/UnityProgress.js"></script>
<script src="Build/UnityLoader.js"></script>
<script>
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/Builds.json", {onProgress: UnityProgress});
</script>
</head>
<body>
<div class="webgl-content">
<div id="gameContainer"></div>
</div>
</body>
</html>
Thanks for the answer! Sorry I forgot about this question because answers didn't seem to be co$$anonymous$$g in. Editing the code didn't work (it made the game screen really tiny) but building with the $$anonymous$$imal template did. Uploading to GitHub was very helpful though.
https://ericranstrom.github.io/ericranstrom/general/unity_github_pages/ has a tutorial for setting up a github pages blog with playable unity games
While this is a good resource for making a blog on Github Pages, it is not very useful for this purpose as we are trying to put our unity games on Google Sites.
Using your method would result in a window containing a blog containing the unity game.
Answer by jcowen · Dec 08, 2019 at 06:12 PM
You can now host directly on the Unity Connect site with a public URL....
Your answer
Follow this Question
Related Questions
Unity WebGL builds on a Squarespace site 3 Answers
WebGL Uncaught RangeError 2 Answers
how to host webgl application on cpanel? 0 Answers