Last modified November 22, 2014 by Gordon Glauser

Unity SDK Upgrade Guide

This guide provides information about how you can upgrade to the latest Swrve Unity SDK. For information about the changes that have been made in each Unity SDK release, see Unity SDK Release Notes.

Version 4.11

This section provides information to enable you to upgrade to Swrve Unity SDK v4.11.

Rich Push Notifications for iOS

Ensure that your PlayerSettings.applicationIdentifier and PlayerSettings.appleDeveloperTeamID is set in your Unity Project. These are used to construct the new app service extension required for rendering rich media in push notifications. For more information, please see the Notification Service Extension for Swrve Rich Push section in the Unity Integration Guide.

Tracking Influenced Users

For iOS, you need to add an App Group Identifier to the key iOSAppGroupIdentifier to your postprocess.json. For more information on why, see the Tracking Influenced Users section in the Unity Integration Guide.

Default Android O Channel

The Swrve Unity SDK now includes a default Android O channel to display your notifications. You can configure this default channel via the SwrveConfig before initialization:

config.DefaultAndroidChannel = new AndroidChannel(“id”, “name”, AndroidChannel.ImportanceLevel.Default);


Version 4.10.1

No code changes are required to upgrade to Swrve Unity SDK v4.10.1.


Version 4.10

This section provides information to enable you to upgrade to Swrve Unity SDK v4.10.

Silent Push Notifications

To enable silent push notifications, complete the steps outlined under Configuring Silent Notifications in the Unity Integration Guide.


Version 4.9.2

No code changes are required to upgrade to Swrve Unity SDK v4.9.2.


Version 4.9.1

No code changes are required to upgrade to Swrve Unity SDK v4.9.1.


Version 4.9

This section provides information to enable you to upgrade to Swrve Unity SDK v4.9.

SIM Information

If you want to keep sending the SIM information out-of-the-box, make sure to add the android.permission.READ_PHONE_STATE to your Android build.


Version 4.8

This section provides information to enable you to upgrade to Swrve Unity SDK v4.8.

Advertising Identifier (IFDA) Logging

IDFA logging is now disabled by default. If you want to continue logging IDFA, add the SWRVE_LOG_IDFA flag to your project settings as shown in the Unity documentation, Platform Dependent Compilation.


Version 4.7

No code changes are required to upgrade to Swrve Unity SDK v4.7.


Version 4.6

This section provides information to enable you to upgrade to Swrve Unity SDK v4.6.

Change to C# Namespace

The main Swrve Unity C# namespace has been changed from Swrve to SwrveUnity. This is only required if you are upgrading from a previous version of the SDK.

If you have included Swrve with a using statement at the top of your class files, for example:

Change it to:

If you’re accessing files directly (without a using statement), for example:

Change it to:

Windows Integration Requirements

The Unity SDK now includes Beta support for Windows 10. There are no extra steps required to integrate Windows in the the Swrve Unity SDK v4.6; however, note the following build limitations:

  • The Microsoft.NETCore.UniversalWindowsPlatform is automatically set to 5.1.0.
  • Due to issues in the Unity build system, the SDK currently only supports building to C# projects.
    • To set the build settings in the Unity Editor, in the Build Settings, select Unity C# Projects:
      unity_projects
    • To set the build settings in the code:

Version 4.5.3

No code changes are required to upgrade to Swrve Unity SDK v4.5.3.


Version 4.5.2

This section provides information to enable you to upgrade to Swrve Unity SDK v4.5.2 if upgrading from v3.8 or older. This version replaces v4.5 and v4.5.1.

appId

References to gameId have been replaced with appId, so you may need to update the SwrvePrefab and the SwrveConfig in your code.

iOS

Remove the swrve_sdk.mm file from the Assets/Plugins/iOS folder, as it will be replaced by the new file UnitySwrveExternC.mm.

Android

Push Notification Upgrade

If you are using the Swrve push notifications Android plugin, you need to upgrade it using the following steps:

Step 1: Remove the following libraries from your Assets/Plugins/Android folder:

  • android-support-v4.jar
  • google_play_services_ads_8_4_0.jar
  • google_play_services_base_8_4_0.jar
  • google_play_services_basement_8_4_0.jar
  • Google_play_services_gcm_8_4_0.jar
  • swrvesdkpushsupport.jar
  • Swrvesdkpushsupport.jar
  • AndroidManifest.xml

Step 2: Modify your AndroidManifest.xml and remove the following services, receiver and metadata entries:

Step 3: Make sure that the contents of the .unityPackage Assets/Plugins/Android is properly copied to your project.

Step 4: Click on the menu Swrve -> Correct ${applicationId} in AndroidManifests or manually replace the instances of ${applicationId} in the XML files in Assets/Plugins/Android with your app’s package name.

Changes to the Unity Build Process

Unity SDK v4.5 and above includes native plugins to support numerous features, mainly Swrve Conversations. Due to this, there are native plugins written for Android, which complicate the build process. Unfortunately, when dealing with the native side of things on Android and iOS, Unity has a variety of bugs, across different versions of Unity.

Android

Swrve Conversations, and its supporting files, are packaged as Android libraries, or .aar files. For full support of Swrve Conversations, you need to make sure you’re using a version of Unity that supports processing of .aar files; the latest versions of Unity work best.

Even with the latest version of Unity, they don’t support modern features from Android, such as the use of ${applicationId} in AndroidManifest.xml files. Due to this, any of our plugins that contain ${applicationId} are set up as an Android Library Project Folder in Unity, and before building for Unity, you must run SwrveBuildComponent.CorrectApplicationId(), which replaces ${applicationId} with your projects bundle ID. If you’re running CI builds, it’s best to call this before every Android build.

There is also a helper menu item to do this, Swrve -> Correct ${applicationId} in AndroidManifests.

If you run into problems while building for Android, it’s most likely due to packaging issues around the .aar files. Using the latest version of Unity will fix these issues.


Version 4.5.1

Swrve Unity SDK v4.5.1 has been replaced by v4.5.2. For more information, see above.


Version 4.5

Swrve Unity SDK v4.5. has been replaced by v4.5.2. For more information, see above.


Version 3.8

No code changes are required to upgrade to Swrve Unity SDK v3.8.


Version 3.7

No code changes are required to upgrade to Swrve Unity SDK v3.7.


Version 3.6

This section provides information to enable you to upgrade to Swrve Unity SDK v3.6.

SDK Shared Instance

The SDK shared instance now uses Object.FindObjectsOfType instead of Resources.FindObjectsOfTypeAll. Ensure your prefab is in the scene and active.


Previous Versions

If you are upgrading from a version older than 3.6, please refer to the Unity Integration Guide.