Configure your Ondara project.
Get your API key from the project settings in the dashboard:
1// Unity C#2await Ondara.Initialize("YOUR_API_KEY");3
4// With options5await Ondara.Initialize(new OndaraConfig6{7 ApiKey = "YOUR_API_KEY",8 Environment = Environment.Development,9 LogLevel = LogLevel.Debug10});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'1// Unity C# - Full configuration2var config = new OndaraConfig3{4 ApiKey = "YOUR_API_KEY",5 Environment = Environment.Development,6 AutoRetry = true,7 MaxRetries = 5,8 Timeout = 60000,9 OfflineMode = true,10 CacheExpiry = 7200,11 LogLevel = LogLevel.Debug,12 13 // Custom error handler14 OnError = (error) => Debug.LogError($"Ondara Error: {error.Message}"),15 16 // Analytics opt-out17 EnableAnalytics = true,18};19
20await Ondara.Initialize(config);Use different configurations for development and production:
1#if UNITY_EDITOR || DEVELOPMENT_BUILD2 var apiKey = "dev_api_key_xxx";3 var environment = Environment.Development;4#else5 var apiKey = "prod_api_key_xxx";6 var environment = Environment.Production;7#endif8
9await Ondara.Initialize(new OndaraConfig10{11 ApiKey = apiKey,12 Environment = environment13});