You're 3 steps away from adding great in-app support to your Unity game.
Guide to integrating the Unity plugin for the Helpshift SDK X which you can call from your C# and Javascript game scripts.
Helpshift SDK .zip folder includes:
.unitypackage
which you can import through the Unity package import procedure.helpshiftx-plugin-unity-version.unitypackage
into your Unity game:helpshiftx-plugin-unity-version.unitypackage
file to import the Helpshift SDK.iOS/Helpshift.framework
folder while importing the unitypackage. Refer here.On adding Helpshift package to your project you will see a menu option Helpshift/Verification
in the main menu bar of Unity IDE.
You will need to provide the Domain name
and App ID (same as Platform ID)
for either Android or iOS platform and then Verify
the package.
Wait for package verification to be successful.
This verification is mandatory to avoid Android/iOS build failures.
This verification needs to be done only once.
You can commit the files generated in Assets/Helpshift/Editor/Resources/
to your version control system to share this verification result across developers in your organisation.
Helpshift SDK depends on android appcompat libraries. You can get these libraries in one of the following ways depending on the build process that you use.
Use Unity Jar Resolver plugin to download and integrate android library dependencies.
If your project already uses the Unity Jar Resolver, you can skip the Unity Jar Resolver importing step.
You can use any version of Unity Jar Resolver as per your needs. Helpshift packages this for convenience of developers.
You can find the Unity Jar Resolver releases here: https://github.com/googlesamples/unity-jar-resolver/tags
Import the Unity Jar Resolver plugin into your Unity project
unity-jar-resolver/external-dependency-manager-1.2.170.unitypackage
file to import the Unity Jar resolver.If the Unity Jar resolver wants to enable Android Auto-resolution, click the Enable button, to resolve all the dependencies automatically on changing any dependency file. You can enable or disable the settings using Assets > Play Services Resolver > Android Resolver > Settings
Unity's in-built gradle build support and exporting to android studio does not support per plugin gradle script. Therefore, by default, Helpshift SDK cannot add the dependencies by itself.
The mainTemplate.gradle
is genereted when you enable the Custom Gradle Template property on the Player window.
The build.gradle
exists in generated Gradle project when you enable the Export Project property on the Player window and Build the project.
Update dependencies section of the mainTemplate.gradle
or build.gradle
file as:
dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation(name: 'Helpshift', ext:'aar') implementation 'com.android.support:appcompat-v7:28.0.0' //... }
Please refer to Unity's Gradle template documentation here: https://docs.unity3d.com/Manual/gradle-templates.html
To use Helpshift's APIs, please import the Helpshift's namespace like below
using Helpshift;
First, create an app on the Helpshift Dashboard show me
Create an app with Android as a selected Platform
show me
Helpshift uniquely identifies each registered App with a combination of 2 tokens:
Domain Name
Platform ID
Settings
>SDK (for Developers)
in your agent dashboard.
Select your App and check Android as a platform from the dropdowns and copy
the 2 tokens to be passed when initializing Helpshift.
show me
Initialize Helpshift by calling the method install(appId, domain) API
using Helpshift; . . . public class MyGameControl : MonoBehaviour { private HelpshiftSdk help; ... void Awake() { help = HelpshiftSdk.GetInstance(); var configMap = new Dictionary<string, object>(); help.Install(appId, domainName, configMap); } ... }
Placing the install call
You should place install call inside the Awake()
method. Placing it elsewhere might cause unexpected runtime problems.
HelpshiftInitializationException
Calling any API before the install call would throw an unchecked HelpshiftInitializationException in debug mode.
Android OS version Support
Calling install()
below android SDK version 21 will not work. All the APIs will be non operable.
Helpshift is now integrated in your app. You should now use the support APIs for conversation screens inside your app.
Run your app, and try starting a test conversation using the ShowConversation API call. Then goto your Helpshift agent dashboard and reply to experience the in-app messaging.
Sample usage for FAQs and conversation APIs:
public class MyGameControl : MonoBehaviour { private HelpshiftSdk help; void Awake(){ // install call here } void OnGUI () { ... var configMap = new Dictionary<string, object>(); // Starting a conversation with your customers if (MenuButton (contactButton)) { help.ShowConversation(configMap); } } }
Since the Helpshift plugin is meant for mobile devices only, you should put all Helpshift calls inside checks to make sure they are only called when running on a device.