Initial SDK Setup
Follow the below instructions to get Braze running in your Unity application. If you are transitioning from a manual integration, please read the instructions on Transitioning From a Manual to an Automated Integration.
Step 1: Choose your Braze Unity Package
.unitypackage bundles native bindings for the Android and iOS platforms, along with a C# interface.
There are several Braze Unity packages available for download at Braze Unity Releases Page:
- This package bundles the Braze Android and iOS SDKs as well as the SDWebImage dependency for the iOS SDK, which is required for 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.
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
Step 2: Import the Package
- In the Unity Editor, import the package into your Unity project by navigating to
Assets > Import Package > Custom Package.
- Click “Import”.
Alternatively, follow the Unity instructions for Importing Asset packages for a more detailed guide on importing custom Unity packages.
If you only wish to import the iOS plugin, deselect the
Plugins/Android subdirectory when importing the Braze
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
- 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 from the Braze Dashboard. Your Braze Configuration settings should look like this:
If your application is already using another
UnityAppControllersubclass, you will need to merge your subclass implementation with
Step 4: Basic SDK Integration Complete
Braze should now be collecting data from your application and your basic integration should be complete.
See the Push documentation for information on integrating push.
See the In-App Message documentation for information on integrating in-app messages.
Content Cards Integration
See the Content Cards documentation for information on integrating Content Cards.
News Feed Integration
See the News Feed documentation for information on integrating the News Feed.
Extending the SDK
To extend the SDK’s behaviors, fork our Braze Unity SDK Github project and make your required changes.
To publish your modified code as a Unity package, see Advanced Use Cases.
Transitioning from Manual to Automated Integration
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
- Remove Braze’s iOS libraries from your Unity or Xcode project (i.e.,
SDWebImage.framework) and import the Braze Unity package into your Unity project.
- Follow the integration instructions on setting your API key through Unity.