This repo is deprecated
Get the Branch Unity SDK here!
The TUNE plugin for Unity provides application session and event logging functionality via the TUNE native SDKs.
- TUNE Android SDK 6.1.2
- TUNE iOS SDK 6.2.0
This plugin was built and tested with Unity version 2018.2.11f1 LTS
.
Unity 2018+
Google Unity Jar Resolver. This plugin handles Android and iOS dependency management for the TUNE plugin.
For iOS builds:
- Xcode
- Cocoapods
For Android builds:
- Android Studio
Download Tune.unitypackage
from the releases section.
While your Unity project is open, double click the unitypackage. It should install. Otherwise, you can import it via the menu, Assets
-> Import Package
-> Custom Package
.
Create a new Tune script and attach it to an object.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TuneSDK;
public class TuneScript : MonoBehaviour {
private void Awake()
{
// verbose debug messages
//Tune.SetDebugMode(true);
Tune.Init("your_advertiser_id", "your_conversion_key");
Tune.MeasureSession();
}
private void OnApplicationPause(bool pause)
{
if (!pause) {
Tune.MeasureSession();
}
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
Sample script in an example project:
Sample script attached to an object:
Switch platform to Android or iOS. Go into Player Settings and change the default Android package name or iOS bundle identifier to something other than com.Company.ProductName
.
Sample Android build settings:
Sample Android package name change:
For Android, Unity will export an apk file.
For iOS, Unity will export a folder with all the project files.
From a terminal, use adb install
to install the apk file to a device.
If you enabled debug, you can see Tune calls in the logs by using adb logcat
.
Find and open the Unity-iPhone.xcworkspace
file.
In the Unity-iPhone
target, set the Apple developer to your developer account.
Debug on a device. Unity projects do not support simulator.
Open /sample/Assets/Tune/Scenes/TUNESampleScene.unity in Unity.
Build and export as you would your own project. The TUNE sample app displays a menu that uses the TUNE Unity plugin's various functionalities. To see samples of how to use the plugin in your own code, see our sample script.