1) Download the latest SDK from deltaDNA Unity SDK documentation page.

2) Import the SDK into your Unity project as a new custom package by selecting the Assets -> Import Package -> Custom Package  menu option in Unity and selecting the SDK file you downloaded in the previous step. Import all the files from the SDK package when prompted.

3) A deltaDNA Example scene and scripts will have been added to your project as well as the SDK code. Navigate to the DeltaDNA \ Example  folder in the Unity Project Browser if you want to review the example scene and any of the code used in it. The example folder and files can be removed if you do not require them.

4) In order to start sending events from your game to deltaDNA you need to start the SDK with some initialisation parameters that will identify which game the data is originating from. These initialisation details can be found on your “Game Details” page on deltaDNA. Copy and Paste the Dev & Live environment keys and the Collect and Engage URLs into the DeltaDNA -> Configure panel in the Unity Editor, apply your changes then save and re-load your Unity project.

You are now nearly ready to start up the SDK and send some events.

For the purposes of this tutorial.

  1. Create a new Empty Game Object in your scene
  2. Add a new C# script to the new Game Object
  3. Open the script and paste in the following code.
  4. Add the following line before the StartSDK() method to turn on console debugging if you want to see what the SDK is doing in your Unity Console.

Now when you Run your game it will start the deltaDNA SDK and automatically send the first simple events.

  • newPlayer. This event is recorded the first time the game is launched, after installation.
  • gameStarted. This event is recorded every time the game is launched. It is used to track player sessions and the version of the game the player is playing.
  • clientDevice. This event is also recorded every time the game is launched. It is used to track the type of device the player is using.

These 3 events are recorded automatically by the SDK. It is possible to disable this automatic behaviour in order to extend the events with additional custom parameters and record them manually yourself. If you want to do this you would disable the following settings before starting the SDK.

Only disable these automatic events if you intend to extend them and record them in your own code. If they are not sent valuable information will be lost and some Measure charts will not populate.

Your first three, automatic events, will be uploaded to deltaDNA immediately when the SDK is started. The SDK will attempt to upload subsequent events that you record in your code at regular 1 minute intervals. The automatic upload behaviour and it’s frequency can be overridden if you prefer to control the timing them yourself. Check out the DDNA.Instance.Settings  BackgroundEventUpload...  properties for more information.

If you don’t send events often enough you risk losing data if the player loses connectivity or stops playing between uploads, so be careful if you change the Background Event Upload settings.

As well as the automated events, you can record your own custom events or standard templated events at any time in your game and they will be cached locally until you call events the DDNA.Instance.Upload(); method, or the automated event uploader runs. Use the DDNA.Instance.RecordEvent() method to record events and set their parameters.

There are also some useful helper methods to help you build the more complex data structures found in rewards and transactions.

Your events will be uploaded to deltaDNA as an HTTP POST containing an array of events in a JSON document in the POST body.

You can use the “Event Browser” tool in the SETUP menu to check your most recent valid and invalid events, inspect the data and review any error reports. This will help you identify and fix any errors before publishing your event schema to the LIVE environment. deltaDNA undertakes strict event validation on your events to prevent your data from getting corrupted. Approximately 10 standard events, used to populate the standard Measure dashboards, are added to the event schema when your game is added to deltaDNA. If you wish to extend these events with more parameters or add new events you should use the Event Management tool to specify the event schema and the Event Browser to test your events before publishing them to the LIVE environment.

Finally, when you have implemented all your events and confirmed that they are working correctly you should publish them to the LIVE environment using the publish button in the Event Manager in your DEV environment. You can then change the environmentID in your SDK startup code to the LIVE environmentID and submit your game to the App store.

Please note: It is important that you only send live production traffic to your LIVE environment and development and QA data to your DEV environment. There are unique environment keys for each environment on your “Game Details” page that should be used in your SDK Start method to determine which environment your events should be directed to.

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.