|
1 | | -# TUNE Unity Plugin v5.0.0 |
| 1 | +# TUNE Unity Plugin v6.0.0 |
2 | 2 |
|
3 | | -Includes: |
4 | | -* TUNE Android SDK 5.0.2 |
5 | | -* TUNE iOS SDK 5.0.2 |
| 3 | +The TUNE plugin for Unity provides application session and event logging functionality via the TUNE native SDKs. |
6 | 4 |
|
7 | | -## Usage |
| 5 | +* TUNE Android SDK 6.0.2 |
| 6 | +* TUNE iOS SDK 6.0.3 |
8 | 7 |
|
9 | | -This plugin was last built and tested with Unity version 2017.3.0f3. |
| 8 | +This plugin was built and tested with `Unity version 2017.4.15f1 LTS`. |
10 | 9 |
|
11 | | -Please see the Quick Start guide here: |
| 10 | +## Dependencies |
12 | 11 |
|
13 | | -[Unity Quick Start](https://developers.tune.com/sdk/unity-quick-start/) |
| 12 | +Unity 2017+ |
14 | 13 |
|
15 | | -## Sample |
| 14 | +[Google Unity Jar Resolver](https://github.com/googlesamples/unity-jar-resolver). This plugin handles Android and iOS dependency management for the TUNE plugin. |
16 | 15 |
|
17 | | -Open **/sample/Assets/Tune/Scenes/TUNESampleScene.unity** in Unity. |
| 16 | +For iOS builds: |
| 17 | + |
| 18 | +* Xcode |
| 19 | +* [Cocoapods](https://cocoapods.org/) |
| 20 | + |
| 21 | +For Android builds: |
| 22 | + |
| 23 | +* Android Studio |
| 24 | + |
| 25 | +## Install Tune Unity Plugin |
| 26 | + |
| 27 | +Download `Tune.unitypackage` from the releases section. |
| 28 | + |
| 29 | +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`. |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +Create a new Tune script and attach it to an object. |
| 34 | + |
| 35 | +``` |
| 36 | +using System.Collections; |
| 37 | +using System.Collections.Generic; |
| 38 | +using UnityEngine; |
| 39 | +using TuneSDK; |
| 40 | +
|
| 41 | +public class TuneScript : MonoBehaviour { |
| 42 | +
|
| 43 | + private void Awake() |
| 44 | + { |
| 45 | + // verbose debug messages |
| 46 | + //Tune.SetDebugMode(true); |
| 47 | + |
| 48 | + Tune.Init("your_advertiser_id", "your_conversion_key"); |
| 49 | + Tune.MeasureSession(); |
| 50 | + } |
| 51 | +
|
| 52 | + private void OnApplicationPause(bool pause) |
| 53 | + { |
| 54 | + if (!pause) { |
| 55 | + Tune.MeasureSession(); |
| 56 | + } |
| 57 | + } |
| 58 | +
|
| 59 | + // Use this for initialization |
| 60 | + void Start () { |
| 61 | + |
| 62 | + } |
| 63 | + |
| 64 | + // Update is called once per frame |
| 65 | + void Update () { |
| 66 | + |
| 67 | + } |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +Sample script in an example project: |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +Sample script attached to an object: |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | +## Build and export project |
18 | 80 |
|
19 | 81 | 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`. |
20 | 82 |
|
21 | | -Then select **Build and Run**. |
| 83 | +Sample Android build settings: |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | +Sample Android package name change: |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | +For Android, Unity will export an apk file. |
| 92 | + |
| 93 | +For iOS, Unity will export a folder with all the project files. |
| 94 | + |
| 95 | +## Running Android |
| 96 | + |
| 97 | +From a terminal, use `adb install` to install the apk file to a device. |
| 98 | + |
| 99 | +[adb documentation](https://developer.android.com/studio/command-line/adb) |
| 100 | + |
| 101 | +If you enabled debug, you can see Tune calls in the logs by using `adb logcat`. |
| 102 | + |
| 103 | +## Running iOS |
| 104 | + |
| 105 | +Find and open the `Unity-iPhone.xcworkspace` file. |
| 106 | + |
| 107 | +In the `Unity-iPhone` target, set the Apple developer to your developer account. |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | +Debug on a device. Unity projects do not support simulator. |
| 112 | + |
| 113 | +## Using the bundled Sample App |
| 114 | + |
| 115 | +Open **/sample/Assets/Tune/Scenes/TUNESampleScene.unity** in Unity. |
| 116 | + |
| 117 | +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](sdk-unity/sample/Assets/Tune/Scripts/TuneSample.cs). |
| 118 | + |
22 | 119 |
|
23 | | -This will run the TUNE sample app and display 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](sdk-unity/sample/Assets/Tune/Scripts/TuneSample.cs). |
|
0 commit comments