SDK iOS integration
Follow these guide to get Braze running in your Unity application. If you are transitioning from a manual integration, read the instructions on Transitioning to an automated integration.
Step 1: Choose your Braze Unity package
The Braze .unitypackage
bundles native bindings for the Android and iOS platforms, along with a C# interface.
There are several Braze Unity packages available for download on the Braze Unity releases page:
Appboy.unitypackage
- This package bundles the Braze Android and iOS SDKs and the SDWebImage dependency for the iOS SDK, which is required for the proper functionality of Braze’s In-App Messaging, and Content Cards features on iOS. The SDWebImage framework is used for downloading and displaying images, including GIFs. If you intend on utilizing full Braze functionality, download and import this package.
Appboy-nodeps.unitypackage
- This package is similar to
Appboy.unitypackage
except for the SDWebImage framework is not present. This package is useful if you do not want the SDWebImage framework present in your iOS app.
- This package is similar to
iOS: To see if you require the SDWebImage dependency for your iOS project, visit the iOS in-app message documentation.
Android: As of Unity 2.6.0, the bundled Braze Android SDK artifact requires AndroidX dependencies. If you were previously using a jetified unitypackage
, then you can safely transition to the corresponding unitypackage
.
Step 2: Import the package
In the Unity Editor, import the package into your Unity project by navigating to Assets > Import Package > Custom Package. Next, click Import.
Alternatively, follow the Unity asset package import instructions for a more detailed guide on importing custom Unity packages.
If you only wish to import the iOS or Android plugin, deselect the Plugins/Android
or Plugins/iOS
subdirectory when importing the Braze .unitypackage
.
Step 3: Set your API key
Braze provides a native Unity solution for automating the Unity iOS integration. This solution modifies the built Xcode project using Unity’s PostProcessBuildAttribute
and subclasses the UnityAppController
using the IMPL_APP_CONTROLLER_SUBCLASS
macro.
- In the Unity Editor, open the Braze Configuration Settings by navigating to Braze > Braze Configuration.
- Check the Automate Unity iOS Integration box.
- In the “Braze API Key” field, input your application’s API key found in Manage Settings.
If your application is already using another UnityAppController
subclass, you will need to merge your subclass implementation with AppboyAppDelegate.mm
.
Basic SDK integration complete
Braze should now be collecting data from your application, and your basic integration should be complete. Check out the following articles for more information on integrating push (Android and iOS), in-app messages, Content Cards, and News Feed.
Additional advanced implementation options
Extending the SDK (iOS)
To extend the SDK’s behaviors, fork the Braze Unity SDK GitHub project and make your required changes.
To publish your modified code as a Unity package, see our Advanced use cases.
Transitioning from manual to automated integration (iOS)
To take advantage of the automated iOS integration offered in the Braze Unity SDK, follow these steps on transitioning from a manual to an automated integration.
- Remove all Braze-related code from your Xcode project’s
UnityAppController
subclass. - Remove Braze’s iOS libraries from your Unity or Xcode project (i.e.,
Appboy_iOS_SDK.framework
andSDWebImage.framework
) and import the Braze Unity package into your Unity project. - Follow the integration instructions on setting your API key through Unity.