After changing to WebGL I was happy that it was going to be easier to distribute and work well.
To build the game I started by setting up the player settings within Unity. The essentials were getting the scenes all placed into the build:
Here are the settings I chose for my WebGL build:
After building the game, I published it to simmer.io. I was originally going to use itch.io but simmer.io is specifically designed for Unity WebGL games so thought it was a better fit.
On the first upload, there were a couple of problems I noticed. For example, if the user's mouse went out of the screen, they could no longer continue to look a certain way. This made the game virtually unplayable as you can only look at a 180 degree angle in from of you. This is something that needed fixing right away. So going back into Unity, I had a look at the script for the first person controller. I couldn't find anything so created a new script and edited the cursor settings based on the Unity API's involving the cursor. Here is the script I created:
This script sets the cursor to be invisible for the game and is not locked to anywhere within the screen.
To make sure the user can see the cursor when the game is paused, I had to edit the pause menu script I had created earlier. These are the alterations I made:
This makes the cursor visible when the game is paused (a nice quality of life improvement), and makes it invisible again once the game is resumed. It also ensures that when the game is paused, the cursor cannot go off the screen.
After editing these the game still would not work correctly on WebGL. I researched this and many people online stated that they had the same issues as well as others with the cursor. It is a known thing that building for WebGL is more frustrating than standalone.
I decided to change the build back to a standalone to see if this was the case. It worked much much better. Everything was working that wasn't on WebGL to do with the mouse cursor. The colours and compression was better. Everything just worked and looked better.
So I decided to use standalone as my game to avoid any problems with the WebGL version. Building this was simple and easy. However distribution is more of a concern. One way to distribute the game is through a zip.folder containing all files needed to run the game. But this is a little cumbersome and is not very user friendly. I needed to find another way to do this.
After considering the risk assessment form, I decided to add a custom horror warning message as part of the splash screen, in order to let players know what to expect from the game, as to avoid any health issues:
This script sets the cursor to be invisible for the game and is not locked to anywhere within the screen.
To make sure the user can see the cursor when the game is paused, I had to edit the pause menu script I had created earlier. These are the alterations I made:
This makes the cursor visible when the game is paused (a nice quality of life improvement), and makes it invisible again once the game is resumed. It also ensures that when the game is paused, the cursor cannot go off the screen.
After editing these the game still would not work correctly on WebGL. I researched this and many people online stated that they had the same issues as well as others with the cursor. It is a known thing that building for WebGL is more frustrating than standalone.
I decided to change the build back to a standalone to see if this was the case. It worked much much better. Everything was working that wasn't on WebGL to do with the mouse cursor. The colours and compression was better. Everything just worked and looked better.
So I decided to use standalone as my game to avoid any problems with the WebGL version. Building this was simple and easy. However distribution is more of a concern. One way to distribute the game is through a zip.folder containing all files needed to run the game. But this is a little cumbersome and is not very user friendly. I needed to find another way to do this.
After considering the risk assessment form, I decided to add a custom horror warning message as part of the splash screen, in order to let players know what to expect from the game, as to avoid any health issues:
Comments
Post a Comment