Does anyone have any experience or know if it is possible to package a Unity 5 WebGL build as a chrome extension? I have a packaged game that takes a while to download on a Chromebook and was wanting to make it load faster. The only way I can think to do that is to package the WebGL build as an extension to save time from downloading the game.
Any help would be greatly appreciated. Until then I have been sifting through Google’s documentation. Thank you for the aid.
I’ve spent a little time investigating if the WebGL platform of a Unity 5 game could be ported or packaged as a Chrome Extension or Web App - the short answer is no.
Chrome provides 2 ways for developers to administer their product to users: Chrome Extension and Chrome Web App.
The Chrome Extension is essentially a product that executes and runs in the back end. There may be a small interface that the user messes with, but all of the logic is executed behind the scenes.
Chrome Web App
The Chrome Web app is a product that has a front end and a back end - closest representation to a Unity Game -> what the Native Client build essentially was.
The Chrome Extension is undesirable as it doesn't allow the game to create a sandbox webpage (front end) to execute and actually display the game. Furthermore, a Chrome Web App is not possible either as there are security errors that are exposed in the WebGL java-script.
The most problematic issue are the numerous uses of eval throughout the Unity created WebGL java-script. In order to fix this, all instances of eval would need to be abstracted into separate functions, and reference those functions instead. Additionally, each eval instance would need to be communicated, via addEventListener or postMessage, to the game i-frame that would execute the java-script, and return the result. This could not be something that could be automated and could be very error prone if an instance were missed.
In conclusion, the WebGL platform packaged as a Chrome Web app isn’t something that I would consider feasible.