Hosting Unity WebGL games?

Has anyone hosted a Unity WebGL game on Render, without committing the compiled game artifacts to version control?

1 Like

You should be able to download the artifacts from an external resource during the build process. How large are the artifacts?

Yes, that’s the easy part. We can download them and/or set up webhooks during the build process. The files are on the order of megabytes, at least 20mb for a trivial example.

The question here is whether / how we can automate hosting those artifacts on Render without git as the intermediary.

We already know it’s possible to launch a static site on Render with WebGL artifacts from a git repo. We’re trying to avoid version controlling those artifacts.

Sorry if I’m misunderstanding you’re post.

I was trying to say that you can create a build script that downloads artifacts from any external resource during the build process (eg. S3). You will still need to connect a repo to the static site. It could simply be a repo with the download script if the assets are already fully built and ready to be served.

Ah! I think I understand now. You meant the Render build step, not the Unity build step. Thank you. I’ll explore that.

1 Like

The next problem is dealing with PR previews.
Context: We also have a unique Unity build per PR, inspired by Render’s automation :slightly_smiling_face:. We can use Render’s service webhook to trigger a deploy when the Unity build finishes on main, because we know the webhook URL in advance.
Wondering how we could pull off something similar for the PR preview services, without a priori known webhooks. Any ideas?

We are working on API right now that would give you a bit more flexibility, but here is a potential workaround in the meantime: We trigger a build as soon as the PR opens. So if you are able to run your Unity build and then open a PR once it’s ready, that would trigger the build and download the assets. That does lead to the question of how to tell the preview build where to get the assets from. We offer a few environment variables during the build that you could take advantage of to dynamically download content. You could potentially upload your assets to https://some.url/{commit-hash} and then use the commit hash environment variable in the Render build to download the assets.

Would that work for you?