When I started this site, one of my first steps was to find out how to post my Unity sample games to WordPress. It’s a simple process, but one that still took a bit to work out. Resolving this has helped me liven up some articles, such as the basics kickoff of my shader series.
There wasn’t much out there to help, and I found myself buying multiple solutions to get the right feature set. In the end, I found my favorite, so hopefully this post can shorten your journey.
If you have any questions or concerns, ping me on Twitter or comment on the forum. And if it is working, a follow on Twitter, a download of my free shader graph node, or a purchase of a recommended asset is always appreciated.
This article may contain affiliate links, mistakes, or bad puns. Please read the disclaimer for more information.
Asset Store over WordPress Plugin
For starters, there are hits in both the WordPress store for “Unity” and the Unity Asset Store for “WordPress”. The WordPress plugin search was no good. Everything there is out of date (using the webplayer not WebGL builds) or not quite functional. You could also write your own plugin, but that sounds like a lot of work.
On the Unity Asset Store front, there are a few promising options. Strangely enough, these asset store items do not generally contain anything you put in your project. They actually contain WordPress plugins (how to deal with them later). I tried several, and the best I found has a bit of a long name with “Easy WebGL WordPress Plugin with Pro Advertising System” (I’m using version 1.0.4).
Easy WebGL
This purchase was well worth it. The plugin works simply, with the right amount of customization. You can use it to embed WebGL games in posts or pages, with pain-free set up for things like loading screens.
At the core, the other plugins available in the asset store are functionally the same. You can upload a game, and embed it in a page. But that’s where the similarities end. Easy WebGL is a much more robust plugin than the competition. For one, the documentation is far better and more thorough. Secondly, interacting with the plugin itself is the sort of experience you’d expect from a professional plugin creation crew. Not to insult the other options. They work, but just aren’t polished to the degree you’re used to if you’ve spent much time in WordPress.
Features
The plugin provides a simple mechanism for uploading and exposes many options. All options can be set at a global level, and then overridden per-game as desired, all from a dedicated page on your admin console. The options I found most worth calling out are:
- Easy layout control (aspect ration, alignment)
- Optionally have the loading screen be a clickable ad, and/or have a clickable ad placed over the corner of your game at all times.
- Full and easy control of the static art that goes with the game (loading screens, static pre-load fallback, play button, etc.)
All in all, the interface covers all the items I could think I might want to customize.
Issues
The only issue I have is the documentation. I know I just told you that the documentation was one of this plugin’s strengths. Well, being better than the competition doesn’t make you perfect. In general, it’s fairly thorough, and more involved than most asset store items, but I have two complaints. One is that it assumes a level of WordPress and Unity-WebGL-build experience I think not all its customers have. Second is that the screenshots are low rez, so it’s really hard to tell what’s actually going on (I can’t read any of the text in the screenshots).
Since the docs are my only complaint, I figured I’d give a how-to here. The docs cover the advanced scenarios, but I’ll start at the super basics.
Installing The Unity WordPress Package
What you get with the package is a simple readme, a documentation PDF, and a zip file. The zip file is a fully fledged WordPress plugin. To install that, you’ll want to go to your WordPress admin panel, go to “Plugins->Add New”, and then click the “Upload Plugin” button.
One note here is that the plugin comes with two sample games (great) but no “delete game” functionality. As stated in their docs, you need to go through your cPanel or FTP to actually find the games and remove them. If you don’t want the sample games installed, you can remove them from the zip locally before uploading (unzip, remove, re-zip).
Preparing the Build
Building for WebGL just requires that you have that module installed. If you do not, the easiest way to fix that is to install it form the Unity Hub. Do not click “Development Build” when building the game.
The result of the build will be an “index.html”, with two folders next to it. You need to take the folder that all this is in, and zip it up. The plugin will name this game after that folder, so choose your name accordingly.
Additional Content
To make things look good, there are a few static images you’ll want to create. As I mentioned above, there are many that you can set with this plugin, but for my sample below, I only made two.
- “Background Image” – this is the image shown before anyone starts playing the game. By default this will also have a logo and a play button over it. I’ve disabled the logo, and kept the play button with the provided default.
- Ad Image – it’s not totally obvious, but this is the image shown during loading. It’s called “Ad” image because it can be a clickable ad. To make it not clickable, just blank out the “Ad Link”. By default it links back to a (missing) page on the plugin creators website.
Those are the only images I customized. I turned off the Logo Image and the “Ad Corner Image”, and stuck with the default play and full-screen buttons for now.
Uploading your game
The developers did document this part really well. Basically, you use the plugin from within your WordPress admin page. The only tip I’d add is making sure it installs in a folder you’ll be happy cluttering with games. I chose
public_html/wp-content/uploads/unity3d/games
A Note On Mobile
There are some limitations to when and where WebGL content can play. On desktop you should be fine across the board. On mobile, most likely things will either not work at all, or only work in “desktop mode”. If you are on mobile now, and the game below won’t load, try clicking “request desktop site” (or whatever it’s called in your mobile browser).
Unity WordPress Sample
From there, you just play! I threw a game together to post here so that you’d have a chance to see what this looks like. Just click on the circles to make them bounce…
Loading...
Do something. Make progress Have fun.
Hello a question, I can upload my game but when changing the logo and the other parameters does not update them, it stays like my original game, I can not change anything neither the bar nor the corner etc. help.
(I removed your email from the post to keep you from getting spammed).
Two things. One – note that there is item-specific art (logo and such) as well as global. So it could be some sort of issue where you’re setting one, but the other is pushing itself over the top. Two – from what I can tell, the support email on their website is listed as play.tcubed at gmail.com. So perhaps try email the devs to see if they can work it out.
If you don’t hear back from them, and the art is still not swapping out correctly, post here again and I’ll try some tests on my end. good luck!
Howdy Mr. Bill.
I’m interested in posting a few games that my team and I have developed. I was wondering if you could be of assistance in advising if there are any issues with the webgl product from Unity that you gave the review about. The thing is that the WordPress plugin looks like it will do just what is required. Secondly, I wanted to consult with someone the has actually purchased and used the plugin. Hopefully my request isn’t to much. Please contact me back when you get a few moments and ready to purchase.
Sincerely,
Ruben
Hi Ruben, I’ve only run into two issues with Unity WebGL games. One is on mobile. I just updated this article to mention that sometimes the game won’t play on mobile. Some devices won’t support it at all, and some will only support it if the browser is in “desktop mode”.
Second is updating. Sometimes browsers keep their own cache of a web page. Which can mean if you update your game on the server, the client may not see the update. I don’t think there’s much to be done about this last one. Should you run into any weird issues, I’ve found the Unity community to be a great resource. https://forum.unity.com/forums/webgl.84. Feel free to reach out here as well, but if it’s some weird WebGL issue, the forum may be more knowledgeable.
-Bill
Hello. Sorry if I missed something but I installed the plug-in, upload the game but still I don’t understand how I can embed my game to a post or page. I couldn’t find any option to add this page or even couldn’t understand how can I reach the unzip destination. Please help
Definitely refer to the pdf that came with the plugin, as it goes into some details here. You mentioned that you could upload the game, but couldn’t find the unzip spot. On the left side of your wordpress adnim page (the toolbar that has things like “Posts”, “Pages” or “Appearance”) you should see “Unity3D WebGL Player”. If you select that, there’s a button to “upload a new game”, which will let you upload a zip, and optionally delete the zip once it’s unzipped in place.
If this isn’t what you were asking, or is broken, feel free to reply here, or if it’s easier to have this conversation on a forum, you can reply here: https://forum.unity.com/threads/tutorial-how-to-post-unity-games-to-wordpress.886894/
Good luck!