Configure the SDK
Configure Superwall once when your Unity game starts.
Configure Superwall as early as possible in your first scene. A common pattern is to create a
bootstrap MonoBehaviour, attach it to a GameObject in the first scene, and keep that object alive.
using UnityEngine;
using Superwall;
public sealed class SuperwallBootstrap : MonoBehaviour
{
[Header("Superwall API Keys")]
[SerializeField] private string iosApiKey = "MY_IOS_PUBLIC_API_KEY";
[SerializeField] private string androidApiKey = "MY_ANDROID_PUBLIC_API_KEY";
private void Awake()
{
DontDestroyOnLoad(gameObject);
var apiKey = Application.platform == RuntimePlatform.IPhonePlayer
? iosApiKey
: androidApiKey;
var options = new SuperwallOptions
{
Logging = new Logging { Level = LogLevel.Warn },
Paywalls = new PaywallOptions
{
ShouldPreload = true,
AutomaticallyDismiss = true
}
};
Superwall.Configure(apiKey, options: options, completion: result =>
{
if (result.IsSuccess)
{
Debug.Log("[Superwall] Configured");
return;
}
if (result is ConfigurationResult.FailedResult failed)
{
Debug.LogError($"[Superwall] Configuration failed: {failed.Error}");
}
});
}
}Public API Keys
Use the Public API Key from your Superwall dashboard app settings. If your Unity game ships on both iOS and Android, create or use the matching Superwall app for each platform and choose the key at runtime.
In the current beta, Android reports configuration failures through ConfigurationResult. iOS
reports success when the native SuperwallKit configuration callback completes.
Configuration Options
SuperwallOptions mirrors the native mobile SDK options for paywall behavior, logging, test mode,
locale, and other advanced settings. See Advanced Configuration
for the full beta option surface.
After configuring Superwall, continue to Presenting Paywalls.
How is this guide?