Getting Started

1. Installation

For a fresh installation

  1. Download the WebEngageUnityiOS.unitypackage
  2. Import the downloaded unitypackage into your Unity project through Assets > Import Package > Custom Package....
  3. Replace the framework file at Assets/Plugins/iOS/WebEngage.framework with the latest WebEngage framework. Unzip the downloaded zip file to get the framework.

Updating the native WebEngage SDK within the Unity wrapper

Replace the framework file at Assets/Plugins/iOS/WebEngage.framework with the latest WebEngage framework. Unzip the downloaded zip file to get the framework.

2. Initialization

  1. Add the following values in /Assets/Editor/WebEngagePostProcessBuild.cs file.
...

public class WebEngagePostProcessBuild
{
   [PostProcessBuild]
   public static void EditXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)
   {
       if (buildTarget == BuildTarget.iOS)
       {
       	// Add your WebEngage license code
       	string WEBENGAGE_LICENSE_CODE = "YOUR-WEBENGAGE-LICENSE-CODE";

       	// Set debug log level
           string logLevel = "VERBOSE";
       	...
       }
   }
}

Make sure you replace YOUR_WEBENGAGE_LICENSE_CODE with your WebEngage license code. As shown below, naviagte to the Account Setup section to find your license code.

1438

Locating license code in your WebEngage account

  1. Initialize the WebEngage SDK in your AppDelegate.m class.
#import <WebEngage/WebEngage.h>
...

-(BOOL)application:(UIApplication*) application didFinishLaunchingWithOptions:(NSDictionary*) options
{
    [[WebEngage sharedInstance] application:application didFinishLaunchingWithOptions:options];
    
    ...
}

If you are not already implementing AppDelegate.m in your Unity app, then create a new file at /Assets/Plugins/iOS/OverrideAppDelegate.m and copy the content below in that file.

#import "UnityAppController.h"
#import <WebEngage/WebEngage.h>


@interface OverrideAppDelegate : UnityAppController
@end


IMPL_APP_CONTROLLER_SUBCLASS(OverrideAppDelegate)

@implementation OverrideAppDelegate

-(BOOL)application:(UIApplication*) application didFinishLaunchingWithOptions:(NSDictionary*) options
{
    [[WebEngage sharedInstance] application:application didFinishLaunchingWithOptions:options];
    
    return [super application:application didFinishLaunchingWithOptions:options];
}

@end

So, what's next?