Hello folks,
Unity is great when it comes to cross-platform builds. But even more awesome if you could add another platform to the mix.
- What is it?
I’ve been working on an editor extension that allows you to export your game as a Google Chrome App.
It has been designed to work seamlessly with unity, and most of the build options look very familiar.
- Why?
You can expand your audience and reach people through the Chrome Web Store. Also, it would be the way to go with ChromeBook users, if you want to make your game available offline for them.
- What’s the catch?
Chrome App builder relies on the WebGL build module, but adds to the build and to the player several options and features that are not available to WebGL on the browser, yet are possible as a chrome app. It also improves some of unity’s functions, because of the limitations of the browser.
It works on both unity free and pro. The webgl module is needed for the build, and unity 5.3 and up is highly recommended.
- What’s in the box?
The Chrome App builder is composed of two parts : the builder, and the Chrome App API.
The buider is basically you Player Settings and Build Settings for chrome, does things like :
- Taking care of the manifest file for you
- Creating icons in the appropriate size
- Presentation settings (resolution and such)
- Packing and signing the app
- etc.
Of course the builder implements many techniques to make the development easy and the integration simple (for example, it automatically signs the app and keep the key to maintain the same app id during development)
So, basically, all you need to do is import it to your game, tweak the settings you like and hit the “Build and Run” button.
As for the Chrome App API, it exposes the api that are used in a chrome app, the actual cool stuff, so you can use them in unity. we’re constantly working on these to make the most of them available inside unity. these include but not limited to:
-
Window handling (fullscreen, maximize, minimize, resize, focus, always ontop, close ect). these do not require a user interaction, and can be called any time, unlike the browser. also, you can prevent the esc key from exiting full screen. combined with the frameless window style (no top bar with the x button or the minimize button) you can create these in your game for more style.
-
User Info : you can have access to the currently logged user on chrome, or maybe use and OAuth service to connect him (google, facebook, etc)
-
you can prevent sleep mode, or screen dimming
-
open a website in a new chrome tab maybe
-
and other cool stuff TBA.
-
What does it look like?
Some screenshots of the current prototype :
we tried the plugin on a couple of mobile games, and the integration was somewhat smooth (all we needed to do was to remove the unity ads code from the game, since only android and ios are supported)
of course there’s more to it under the hood (getting a redirect url for OAuth2, using #UNITY_CHROME preprocessor for platform specific programming, showing native chrome notifications, and so on) which will come fully documented in the release version.
here’s an example of a game running on chrome, exported with chrome app builder :
- What’s next?
We are currently polishing up the extension, and looking forward to publish it.
Please answer the poll, and give your opinion about this. If there is a feature request, We’re all ears.