Effective March 30, 2022, support for Adobe Experience Platform Mobile SDKs on Unity is no longer active. While you may continue using our libraries, Adobe no longer plans to update, modify, or provide support for these libraries. Please contact your Adobe CSM for detail.
The Unity Hub
application is required for development and testing. Inside of Unity Hub
, you will be required to download the Unity
app. The ACPAnalytics Unity package is built using Unity version 2019.4.
Download the Unity Hub. The free version works for development and testing, but a Unity Pro license is required for distribution. See Distribution below for details.
Plugins for a Unity project use the following folder structure:
{Project}/Assets/Plugins/{Platform}
- Download ACPCore-1.0.1-Unity.zip
- Unzip
ACPCore-1.0.1-Unity.zip
- Import
ACPCore.unitypackage
via Assets->Import Package
- Download ACPAnalytics-1.0.0-Unity.zip
- Unzip
ACPAnalytics-1.0.0-Unity.zip
- Import
ACPAnalytics.unitypackage
via Assets->Import Package
No additional steps are required for Android installation.
ACPCore 1.0.0 and above is shipped with XCFrameworks. Follow these steps to add them to the Xcode project generated when building and running for iOS platform in Unity.
- Go to File -> Project Settings -> Build System and select
New Build System
. - Download
ACPCore.xcframework
,ACPIdentity.xcframework
,ACPLifecycle.xcframework
andACPSignal.xcframework
. - Download
ACPAnalytics.xcframework
. - Select the UnityFramework target -> Go to Build Phases tab -> Add the XCFrameworks downloaded in Steps 2 and 3 to
Link Binary with Libraries
. - Select the Unity-iPhone target -> Go to Build Phases tab -> Add the XCFrameworks downloaded in Steps 2 and 3 to
Link Binary with Libraries
andEmbed Frameworks
. Alternatively, selectUnity-iPhone
target -> Go toGeneral
tab -> Add the XCFrameworks downloaded in Steps 2 and 3 toFrameworks, Libraries, and Embedded Content
-> SelectEmbed and sign
option.
using com.adobe.marketing.mobile;
using AOT;
[MonoPInvokeCallback(typeof(AdobeStartCallback))]
public static void HandleStartAdobeCallback()
{
ACPCore.ConfigureWithAppID("1423ae38-8385-8963-8693-28375403491d");
}
public class MainScript : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
if (Application.platform == RuntimePlatform.Android) {
ACPCore.SetApplication();
}
ACPCore.SetLogLevel(ACPCore.ACPMobileLogLevel.VERBOSE);
ACPCore.SetWrapperType();
ACPIdentity.RegisterExtension();
ACPAnalytics.RegisterExtension();
ACPCore.Start(HandleStartAdobeCallback);
}
}
ACPAnalytics.ExtensionVersion();
ACPAnalytics.SendQueuedHits();
ACPAnalytics.ClearQueue();
[MonoPInvokeCallback(typeof(AdobeGetQueueSizeCallback))]
public static void HandleAdobeGetQueueSizeCallback(long queueSize)
{
Debug.Log("Queue size is : " + queueSize);
}
ACPAnalytics.GetQueueSize(HandleAdobeGetQueueSizeCallback);
[MonoPInvokeCallback(typeof(AdobeGetTrackingIdentifierCallback))]
public static void HandleAdobeGetTrackingIdentifierCallback(string trackingIdentifier)
{
Debug.Log("Tracking identifier is : " + trackingIdentifier);
}
ACPAnalytics.GetTrackingIdentifier(HandleAdobeGetTrackingIdentifierCallback);
ACPAnalytics.SetVisitorIdentifier("VisitorIdentifier");
[MonoPInvokeCallback(typeof(AdobeGetVisitorIdentifierCallback))]
public static void HandleAdobeGetVisitorIdentifierCallback(string visitorIdentifier)
{
Debug.Log("Visitor identifier is : " + visitorIdentifier);
}
ACPAnalytics.GetVisitorIdentifier(HandleAdobeGetVisitorIdentifierCallback);
- Open the demo app in unity.
- Open the test runner from
Window -> General -> TestRunner
. - Click on the
PlayMode
tab. - Connect an Android or iOS device as we run the tests on a device in play mode.
- Select the platform for which the tests need to be run from
File -> Build Settings -> Platform
. - Click
Run all in player (platform)
to run the tests.
Sample App is located at unity-acpanalytics/ACPAnalytics/Assets/Demo. To build demo app for specific platform follow the below instructions.
- Download ACPCore-1.0.0-Unity.zip
- Unzip
ACPCore-1.0.0-Unity.zip
- Import
ACPCore.unitypackage
via Assets->Import Package
- Make sure you have an Android device connected.
- From the menu of the
Unity
app, select File > Build Settings... - Select
Android
from the Platform window - If
Android
is not the active platform, hit the button that says Switch Platform (it will only be available if you actually need to switch active platforms) - Press the Build And Run button
- You will be asked to provide a location to save the build. Make a new directory at unity-acpanalytics/ACPAnalytics/Builds (this folder is in the .gitignore file)
- Name build whatever you want and press Save
Unity
will build anapk
file and automatically deploy it to the connected device
- From the menu of the
Unity
app, select File > Build Settings... - Select
iOS
from the Platform window - If
iOS
is not the active platform, hit the button that says Switch Platform (it will only be available if you actually need to switch active platforms) - Press the Build And Run button
- You will be asked to provide a location to save the build. Make a new directory at unity-acpanalytics/ACPAnalytics/Builds (this folder is in the .gitignore file)
- Name build whatever you want and press Save
Unity
will create and open anXcode
project- Add XCFrameworks to the Xcode project.
- From the Xcode project run the app on a simulator.
Below is a list of additional Unity plugins from the AEP SDK suite:
Extension | GitHub | Unity Package |
---|---|---|
ACPCore | https://github.com/adobe/unity-acpcore | ACPCore |
AEPAssurance | https://github.com/adobe/unity-aepassurance | AEPAssurance |
ACPUserProfile | https://github.com/adobe/unity_acpuserprofile | ACPUserProfile |
Looking to contribute to this project? Please review our Contributing guidelines prior to opening a pull request.
We look forward to working with you!
This project is licensed under the Apache V2 License. See LICENSE for more information.