Skip to content

Deploying to Mobile

Mat Hopwood edited this page May 26, 2019 · 7 revisions

Introduction

IGX now supports deployment of IGX compatible web games to Android and iOS platforms using Unity 3D as an intermediary. IGX games are hosted in a web view (provided by UniWebView). Unity IGX consists of multiple parts, these include:

  • Unity code which is called from the JS side, this provides native platform functionality
  • A JS lib which communicates with Unity
  • Various plug-ins, some optional

As far as your code is concerned you simply need to call functions in the IGX SDK and don't generally have to tinker with any Unity code.

Features

  • Adverts via Unity Ads (Admob is work in progress)
  • In-app purchasing
  • Social login via Game Centre and Google Play Games
  • Leaerboards via Game Centre and Google Play Games
  • Native sharing
  • Analytics via Unity
  • Open external URL's
  • File uploads
  • Localisation support

Installation and Setup

To deploy your games to mobile using IGX Unity you will need to:

  • Create a new Unity project
  • Install UniWebView
  • Create a folder in your Unity projects Assets folder called StreamingAssets and copy your game files into there. Note that index.html MUST be the games entry point
  • Create a scene
  • Import igx.unitypackage
  • Drag the IGX prefab into your created scene and save the scene
  • In your index.html or in one of you source files you need to initialise IGX by calling FBInstant.createDefaultServices("unity");
You now have a project all set up and ready to deploy

Adverts

If you plan on using adverts in your game then you will need to enable and set up Unity Adsin the Services section of Unity. You will also need to visit the Unity dashboard to get your ad ID and assign this in code using:

FBInstant.options.adsOptions.vendor = "unity";
FBInstant.options.adsOptions.appId = unity_ad_id;

To locate ad ID's go to Unity Dashboard->Develop->Go to Ads and then Settings->Project Settings. Note that ad ID's for iOS and Android may differ. Admob is also supported but that is currently work in progress.

In-app purchasing

If you plan on using in-app purchasing in your game then you will need to install and set up Unity in-app purchasing. You will also need to set up your products on the app store side. In-app purchasing is disabled by default and you will need to enable it by defining IGX_PURCHASING in project Build Settings->Player Settings->Other Settings->Scripting Define Symbols.

Native sharing

In order to use native sharing you will need to install a Unity plugin called Native Share for Unity. Native sharing enables you to allow your users to share screen shots / images and text via social media, messaging etc.. Native sharing is disabled by default and you will need to enable it by defining IGX_SHARING in project Build Settings->Player Settings->Other Settings->Scripting Define Symbols.

Social login and leaderboards

Social login / leaderboards for iOS Game Centre is available out of the box. If you would like to include Google Play Games for Android then you will need to import and set up Google Play Games for Unity and set this up in the Google Play dashboard. GPG is disabled by default and you will need to enable it by defining IGX_GPG in project Build Settings->Player Settings->Other Settings->Scripting Define Symbols. GPG is not available for iOS and should be disabled.

Minimum OS versions:

  • Android 5.0
  • iOS 9.0
You can’t perform that action at this time.