Configuration
The SDK ships with a GameRebellionSettings ScriptableObject located at Assets/GameRebellion/Resources/GameRebellionSettings.
Required Settings
| Field | Type | Description |
|---|---|---|
| Environment | enum | Development, Staging, or Production |
Optional Settings
| Field | Type | Default | Description |
|---|---|---|---|
BatchSizeBytes | int | 65536 | Max batch size in bytes before auto-flush |
BatchMaxEvents | int | 100 | Max events per batch before auto-flush |
FlushIntervalMs | int | 30000 | Time-based flush interval in milliseconds |
EnableCompression | bool | true | Gzip compress event batches |
AutoTrackSession | bool | true | Automatically send session_start/stop events |
TransportType | enum | HTTP | Transport protocol for event delivery |
Initialization
Initialize the SDK as early as possible — ideally in Awake() of a bootstrap MonoBehaviour in your first scene:
using UnityEngine;
using GameRebellionSdk.Unity;
public class GRBootstrap : MonoBehaviour
{
[SerializeField] private string apiKey; // Set via Inspector or env config
private void Awake()
{
bool ok = GameRebellion.Initialize(apiKey);
if (ok)
Debug.Log("GameRebellion SDK ready");
else
Debug.LogError($"GameRebellion init failed: {GameRebellion.GetLastError()}");
}
}
What Happens on Initialize
- The SDK loads
GameRebellionSettingsfrom your Resources folder. - The native core starts the event pipeline (consent gate → validator → enricher → redactor → batcher → transport).
- A hidden
GRMetricsCollectorGameObject is auto-created. It tracks FPS and memory, and manages app lifecycle (pausing sessions on background, resuming on foreground, shutting down on quit). - If
AutoTrackSessionis enabled, asession_startevent is sent immediately.
Shutdown() is handled automatically by GRMetricsCollector when present. If you remove or disable it, you must call GameRebellion.Shutdown() on application quit and manage SetPaused() on app background/foreground transitions yourself.
Platform-Specific Setup
- iOS
- Android
- Unity Editor
The iOS native adapter requires the following Apple frameworks. Add them in Xcode if the build fails with missing symbols:
AdSupportAppTrackingTransparencyAdServicesCoreTelephonySystemConfiguration
The SDK handles IDFA collection and ATT prompts when consent is granted.
The Android adapter is distributed as gr-android-adapter-release.aar. Verify it is in Plugins/Android/.
If you see Failed to find GRAndroidNativeAdapter class, the AAR is missing — re-import the SDK package.
The SDK automatically collects Google Advertising ID (GAID) and Install Referrer data.
In the Unity Editor, the SDK runs in stub mode. API calls return error code -1 because no native adapter is available. This is expected — test on device builds for full functionality.