-
Notifications
You must be signed in to change notification settings - Fork 9
Deploying to Mobile
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.
- Adverts via Unity Ads, Admob and Facebook Audience Network
- 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 or Firebase
- Open external URL's
- File uploads
- Localisation support
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");
If you plan on using adverts in your game then you will need to enable and set up Unity Ads in 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.
You will also need to define _UNTY_ADS_ in the Project Settings->Other Settings->Scripting Define Symbols.
If you want to use Admob then import and set up the Google Ads SDK in Unity. Define _ADMOB_ in Project Settings->Other Settings->Scripting Define Symbols and finally pass your ad placement ID's into FBInstant.getRewardedVideoAsync() and FBInstant.getInterstitialAdAsync().
If you want to use Facebook Audience Network then import and set up the Audience Network SDK in Unity. Define _FAN_ADS_ in Project Settings->Other Settings->Scripting Define Symbols and finally pass your ad placement ID's into FBInstant.getRewardedVideoAsync() and FBInstant.getInterstitialAdAsync(). For FAN you need one additional step which is drag IGXAdsFAN.cs onto the instant of the IGX prefab in the scene.
Note: Do not add multiple ad providers, only add one.
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.
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 / 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.
To enable Firebase analytics define _IGX_FIREBASE_ in project Build Settings->Player Settings->Other Settings->Scripting Define Symbols. Unity analytics will be used if no other analytics provider is used.
- Android 5.0
- iOS 9.0