HoweScape Unity3d WebGL

plugin banner

Plugin to allow the inclusion of a Unity3d WebGL application. A short code is created which can displayed.

Author:P.T.Howe (profile at wordpress.org)
WordPress version required:4.0.0
WordPress version tested:6.0.7
Plugin version:2.3.6
Added to WordPress repository:08-03-2016
Last updated:08-10-2022
Rating, %:66
Rated by:4
Plugin URI:http://www.howescape.com
Total downloads:13 557
Active installs:300+
plugin download
Click to start download

The Unity3d WebGL support creates a directory of files.
This is not convent to load on your WordPress web site.
This plugin takes the contents of the “Build” directory (“Release” in earlier versions) from your game and places it
inside the plugin. When compiling the game you need to select an output directory. This directory name becomes the name of the game.
In the initial version of the plugin for version 5.3.1 the plugin required “Builds_WebGL” to be the game name.
The short code created by the plugin takes parameters which allow selection of the game.
This plugin can then be referenced from with a short code.
The parameters in the short code are the game name and the width and height.

ie. [hs_unity3d_web_gl_game src=”Roll-A-Ball” height=”500″ width=”600″ u3dver=”2020.3″ buildtype=”Production” ]

To extend the support for Unity3d to version 5.5.1 an additional parameter has been added.
This parameter allows the specification of a version. The version support is 5.5.1 or the original version supported by the plugin. (ie. original version 5.3.1)
The Unity3d version 5.5.1. creates a directory “Development”. This is what I have uploaded in the included example. (ie. Roll-A-Ball-5_5_1-Release)
The short code is now looks like the following example.

ie. [hs_unity3d_web_gl_game src=”Roll-A-Ball” height=”500″ width=”600″ u3dver=”5.5.1″ buildtype=”Production”]

In reviewing the latest verion of Unity3d I noticed that the file organization for the WebGL has been updated again.
With this update there are now 7 supported version 5.3.1, 5.5.1, 5.6.0, 2017.4.0f1, 2018.4, 2019.4, 2020.3 and 2021.3.9f1.
When using the newest version you would have a short code like the following.

ie. [hs_unity3d_web_gl_game src=”Roll-a-ball” height=”500″ width=”600″ u3dver=”2019.4″ buildtype=”Production”]

With the latest update to WordPress 5.7 the format of the files has changed agaion. The WebGL build options include the choice of a “Development Build”.
While this options is not recommended for a published game, being able to use in the plugin would helpful. An additional parameter has been added to specify the build type.

ie. [hs_unity3d_web_gl_game src=”Roll-a-ball” height=”900″ width=”900″ u3dver=”2020.3″ buildtype=”Development”]

This feature has four supported values “Development”, “Production”, “Production.GZip”, or “Production.Brotli”.
The parameter is not necessary, if you are using a production build using GZip compression. The player settings Compression Format has 3 possible values.
* Development – No compression
* Production – Same as Production.GZip
* Production.GZip – Same as Production
* Production.Brotli – Compressed with a different algorithm
These values allow you to take advantage of all the possible combinitation.

I have noticed that some users have had difficulty in getting the short code to work as desired. There are a couple of error
messages which are displayed. The parameter “errorreport” has 2 supported values “Normal” and “Verbose”. The default value is “Normal”.
If you have the parameter set to “Verbose” and an error message is displayed additional information may be displayed.

All other features should work as before. There are other features being considered please let me know if you desire anything functionality.

With the addition of the settings page it is now possible to place
the release directory in a zip file. (ie. <gamename>-Release.zip) The default version of Unity selected if no version
is 5.3.1 unless provided.
Once the file is uploaded the setting page for the plugin will allow extraction
of the files into a location which the short code can locate. When naming games from version 5.5.1 and beyond you will need
to include the version number. (ie. <gamename>-5_5_1-Release.zip) With this version place the
files from the Development directory in the zip file. For the latest verion it is the same. (ie. <gamename>-5_6_0-Release.zip)
With the addition of the last 2 version the the version number is now shorter.

In the process of doing the latest update I wanted to switch between the different games to verify that everything was working.
To make this task simpler I added a short code which displays a list of the available games and allows the selection of a game.
The major reason for the addition was game development. Since I thought it might be useful I have added it to the plugin.

ie. [hs_unity3d_web_gl_gamepage]

If you use this short code with just the plugin you will have three games. Four versions of the Roll-A-Ball sample game and the space-shooter sample game.
There are 2 ways games can be added, one is making them part of the plugin. The second is as a zip file which gets uploaded to the media directory.
Once uploaded the uploaded game zip file can be expanded into the plugin from the settings page. There is also a delete option on the settings page.
It can remove any game from the plugin. The page now displays the short code with the parameters you selected. The goal of this display is to assist people in getting a short
code which they can put on there page and display the game.

As the results of a question which was asked, “How can I get information from the browser into the Unity Game?” I have added a short code which adds javascript variables to the page.
The short code is:

ie. [hs_unity3d_current_user]

This adds the following to the HTML page:

ie. var HS_CURRENT_USER_ID=5;var HS_CURRENT_USER_NAME=”gameplayer”;

It is then possible to add code to the Unity Game to extract this information and make it part of the unity game. The 2020 version of roll a ball game displays the user which is logged into the wordpress site.

Arbitrary section

A brief Markdown Example

[hs_unity3d_web_gl_game src=”Roll-A-Ball” height=”500″ width=”600″ u3dver=”2020.3″ buildtype=”Production” errorreport=”Normal”]


Screenshots
FAQ
ChangeLog