Unity
Aidlab Unity SDK provides one Aidlab.AidlabSDK API for Android, iOS, macOS, and Windows. It is distributed as a Unity 6-compatible .unitypackage.
Installation
- Download AidlabSDK-Unity-2.5.0.unitypackage.
- Create or open a Unity 6 project.
- Select
Assets→Import Package→Custom Package.... - Choose the downloaded package and import all files.
The SDK and bundled example use only Unity's built-in runtime APIs, so no additional Unity packages are required.
Quick start
Add this script to a GameObject on Android, iOS, macOS, or Windows:
csharp
using Aidlab;
using UnityEngine;
public sealed class AidlabRespiration : MonoBehaviour
{
private AidlabSDK sdk;
private void Start()
{
AidlabSDK.init("Aidlab");
sdk = FindAnyObjectByType<AidlabSDK>();
sdk.SetCollectSignals(
new[] { Signal.Respiration },
System.Array.Empty<Signal>()
);
AidlabSDK.aidlabDelegate.respiration.Subscribe(OnRespiration);
}
private void OnDestroy()
{
AidlabSDK.aidlabDelegate.respiration.Unsubscribe(OnRespiration);
}
private void OnRespiration()
{
var sample = AidlabSDK.aidlabDelegate.respiration;
Debug.Log($"Respiration: {sample.value} at {sample.timestamp}");
}
}Platform requirements
Android
- Set
Project Settings→Player→Android→Other Settings→Minimum API Levelto Android 9 (API 28) or newer. - Enable Bluetooth on the device.
- The SDK requests the required Bluetooth permission before scanning.
Apple platforms
- Allow Bluetooth access when the operating system asks.
- The SDK post-build step configures the required Bluetooth usage description and framework.
Continue with Establishing Connections and Data Types and Events. For a complete Android example, see Reading user respiration in Unity.