Skip to content

Unity installation

  • Unity 2022.3 LTS or later. For iOS builds use 2022.3.23f1 or newer (earlier 2022.3 builds do not import .xcframework plug-ins); for Android builds use 2022.3.38f1 or newer (earlier ones ship a Gradle plug-in that is too old for the SDK’s libraries).
  • iOS 15 or later, Android minSdk 23 (API level 23) or higher
  • The team’s SDK key (rsk_…) from the form’s Share → Mobile app tab

Set the minimums in Project Settings → Player: Target minimum iOS Version 15.0 and Minimum API Level 23.

The steps use the package URL you received with your access. It is written as <package URL> below.

  1. Open Window → Package Manager.
  2. Click + and choose Add package from git URL…
  3. Enter the package URL and click Add.

Or add the package to the manifest by hand:

Packages/manifest.json
{
"dependencies": {
"com.responsly.sdk": "<package URL>"
}
}

The package name is com.responsly.sdk and the namespace is Responsly. It includes the native libraries for both platforms (Plugins/Android/responsly-sdk.aar and Plugins/iOS/ResponslySDK.xcframework).

The Android library needs three libraries in the Gradle build. Without them no survey can be shown.

androidx.webkit:webkit:1.15.0
androidx.annotation:annotation:1.9.1
org.jetbrains.kotlin:kotlin-stdlib:2.0.21

With the External Dependency Manager for Unity (EDM4U). Nothing to do: the package ships Editor/ResponslyDependencies.xml, and EDM4U adds the libraries when it resolves (Assets → External Dependency Manager → Android Resolver → Resolve). Many SDKs bring EDM4U with them, so you may already have it.

Without EDM4U. Add them to the Gradle templates:

  1. In Project Settings → Player → Android → Publishing Settings enable Custom Main Gradle Template and Custom Gradle Properties Template.

  2. In Assets/Plugins/Android/mainTemplate.gradle add two lines to the dependencies block (androidx.annotation comes with androidx.webkit):

    implementation 'androidx.webkit:webkit:1.15.0'
    implementation 'org.jetbrains.kotlin:kotlin-stdlib:2.0.21'
  3. In Assets/Plugins/Android/gradleTemplate.properties make sure AndroidX is on:

    android.useAndroidX=true

The package warns in the Console before an Android build when it finds neither EDM4U nor these lines. Set Target API Level to 33 or higher. The only permission the SDK adds is INTERNET.

Initialize once, before the first scene loads. A static bootstrap script needs no GameObject.

Assets/Scripts/ResponslyBootstrap.cs
using Responsly;
using UnityEngine;
public static class ResponslyBootstrap
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void Init()
{
ResponslySDK.Initialize("rsk_…", new ResponslyOptions
{
LogLevel = Debug.isDebugBuild ? ResponslyLogLevel.Debug : ResponslyLogLevel.Error,
});
// Stop the game while a survey is on screen.
ResponslySDK.SurveyShown += e => { Time.timeScale = 0; };
ResponslySDK.SurveyCompleted += e => { Time.timeScale = 1; };
ResponslySDK.SurveyDismissed += e => { Time.timeScale = 1; };
}
}

Calls made before Initialize are remembered and applied when the SDK starts. Initialize is idempotent for the same key.

ResponslyOptions has two properties.

PropertyValuesNotes
LogLevelResponslyLogLevel.None, .Error, .Info, .DebugUse Debug while integrating. See Testing & debugging.
ApiHoststringDefaults to https://api.responsly.com. Leave it unset unless Responsly support gives you another host.

In the Editor, and on platforms other than iOS and Android, every call does nothing and writes a log line at the Debug level. No survey appears in Play mode. You can leave the SDK calls in place without platform checks.

To see a survey, build and run on an iOS or Android device, simulator or emulator.

A survey is drawn in a native view above the Unity view. Do not count on the engine pausing by itself: stop the game explicitly.

  • SurveyShown fires when the survey becomes visible. Pause here: set Time.timeScale = 0, pause audio, block input.
  • SurveyDismissed fires when the respondent closes the survey before completing it. Resume here.
  • SurveyCompleted fires when the respondent submits. The thank-you page stays on screen until the survey closes by itself (after the auto-close time set in the Mobile app tab) or the respondent closes it.

If the game should stay paused until the survey is gone, close it yourself on completion:

ResponslySDK.SurveyCompleted += e =>
{
ResponslySDK.CloseSurvey();
Time.timeScale = 1;
};

Events are C# events raised on Unity’s main thread, so you can touch Time, GameObjects and UI directly in the handlers.

Unity has no navigation stack for the SDK to observe. Call ResponslySDK.Screen when your own UI state changes, or report scenes by adding one line to the bootstrap’s Init:

// needs: using UnityEngine.SceneManagement;
SceneManager.sceneLoaded += (scene, mode) => ResponslySDK.Screen(scene.name);