Configure your Ondara project.
Get your API key from the project settings in the dashboard:
12345678910// Unity C#await Ondara.Initialize("YOUR_API_KEY");
// With optionsawait Ondara.Initialize(new OndaraConfig{ ApiKey = "YOUR_API_KEY", Environment = Environment.Development, LogLevel = LogLevel.Debug});apiKeystringRequiredYour project's API key from the dashboard
environment'production' | 'development'Environment mode. Development enables extra logging.
'production'autoRetrybooleanAutomatically retry failed requests with exponential backoff.
truemaxRetriesnumberMaximum number of retry attempts.
3timeoutnumberRequest timeout in milliseconds.
30000offlineModebooleanEnable offline support with local caching.
truecacheExpirynumberCache expiry time in seconds.
3600logLevel'none' | 'error' | 'warn' | 'info' | 'debug'Logging verbosity level.
'warn'1234567891011121314151617181920// Unity C# - Full configurationvar config = new OndaraConfig{ ApiKey = "YOUR_API_KEY", Environment = Environment.Development, AutoRetry = true, MaxRetries = 5, Timeout = 60000, OfflineMode = true, CacheExpiry = 7200, LogLevel = LogLevel.Debug, // Custom error handler OnError = (error) => Debug.LogError($"Ondara Error: {error.Message}"), // Analytics opt-out EnableAnalytics = true,};
await Ondara.Initialize(config);Use different configurations for development and production:
12345678910111213#if UNITY_EDITOR || DEVELOPMENT_BUILD var apiKey = "dev_api_key_xxx"; var environment = Environment.Development;#else var apiKey = "prod_api_key_xxx"; var environment = Environment.Production;#endif
await Ondara.Initialize(new OndaraConfig{ ApiKey = apiKey, Environment = environment});