Skip to main content

Setup

This guide walks you through installing the UG Labs Unity SDK and configuring your Unity project.

Installation

Add Package via Git URL

  1. Open Unity Package Manager (Window > Package Manager)
  2. Click the + button in the top-left corner
  3. Select "Add package from git URL..."
  4. Enter the following URL:
https://github.com/uglabs/ug-unity-sdk.git
  1. Click Add

Unity will download and install the package automatically.

Verify Installation

After installation, you should see UG SDK in your Package Manager under "Packages - Custom".

Project Configuration

Create Settings File

The SDK requires a settings file to store your configuration:

  1. In the Unity Editor menu, go to Assets > Create > UG SDK > Settings
  2. This creates a UGSDKSettings asset in your project
  3. The settings file will be created at: Assets/Resources/UGSDKSettings.asset

Configure Settings

Select the UGSDKSettings asset and configure:

  • API Endpoint: wss://pug.stg.uglabs.app/interact (staging)
  • Access Token: Your UG Labs access token (can be set at runtime)
Runtime Configuration

For security, it's recommended to set the access token at runtime rather than storing it in the settings file:

UGSDK.Instance.Initialize(accessToken);

Platform-Specific Setup

iOS Configuration

For iOS builds, you need to configure microphone permissions:

  1. Open Assets/Plugins/iOS/Info.plist (create if it doesn't exist)
  2. Add microphone usage description:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSMicrophoneUsageDescription</key>
<string>We need access to your microphone for voice conversations with AI characters.</string>
</dict>
</plist>
  1. In Player Settings (Edit > Project Settings > Player):
    • Select the iOS tab
    • Under Other Settings, ensure Microphone Usage Description is set

Android Configuration

For Android builds, add microphone permission to your manifest:

  1. The SDK automatically includes the required permission in its AndroidManifest.xml
  2. Ensure your Target API Level is set to 24 or higher in Player Settings
Permission Requests

The SDK will automatically request microphone permissions at runtime when you start recording. No additional code needed.

Build Settings

Minimum Requirements

iOS:

  • Deployment Target: iOS 13.0 or later
  • Architecture: ARM64

Android:

  • Minimum API Level: 24 (Android 7.0)
  • Target API Level: 33+ recommended
  • Architecture: ARM64

Required Capabilities

The SDK requires network access. Ensure your build settings include:

  • iOS: No additional configuration needed (network access is automatic)
  • Android: INTERNET permission (automatically included)

Troubleshooting

Package Not Found

If you encounter "Package not found" error:

  • Verify the git URL is correct
  • Ensure you have git installed on your system
  • Check your Unity version (6.0+ required)

Microphone Not Working

If microphone recording fails:

  • iOS: Verify NSMicrophoneUsageDescription is set
  • Android: Check that microphone permission is granted in device settings
  • Test on a physical device (microphone may not work in editor/simulator)

Build Errors

If you encounter build errors:

  • Clean the build folder (Build > Clean All)
  • Reimport the SDK package
  • Check Unity console for specific error messages

Next Steps