Configuration Guide
This guide provides detailed information about configuring the Far Out SDK for Unity to meet your specific project needs.
The NasaConfig ScriptableObject
The Far Out SDK uses a central configuration asset to manage all settings. This approach makes it easy to configure the SDK and share settings across your project.
Creating a Configuration Asset
- In Unity, right-click in your Project window
- Select Create > NASA > NasaConfig
- Name the asset (e.g., "NasaSDKConfig")
Configuration Settings
The NasaConfig asset includes the following settings:
API Key
Your NASA API key. Required for all API requests.
- For testing, you can use
DEMO_KEY
, but it has strict rate limits (hourly & daily) - Get your free API key at api.nasa.gov
Cache Settings
Configure how the SDK caches data to reduce API calls and improve performance:
- Enable Disk Cache: Toggle disk caching on/off
- Cache Directory: Specify a custom cache folder or use the default
- Cache Expiration: Set how long items remain in cache (in hours)
- Max Cache Size: Limit the total cache size (in MB)
Network Settings
- Timeout: API request timeout in seconds
- Retry Count: Number of times to retry failed requests
- Rate Limiting: Enable smart rate limit handling
Logging
- Verbose Logging: Toggle detailed logs for debugging
- Log Level: Set minimum log level (Error, Warning, Info, Debug)
Usage with Multiple Scenes
We recommend creating a single NasaConfig asset and either:
- Reference it directly in your scenes
- Create a service locator or singleton to provide access to the configured NasaClient
Runtime Configuration
While most settings are configured via the ScriptableObject, you can also modify some settings at runtime:
// Get a reference to your config asset
NasaConfig config = Resources.Load("NasaSDKConfig");
// Modify settings
config.EnableDiskCache = true;
config.CacheExpirationHours = 24;
// Create client with updated config
NasaClient client = new NasaClient(config);
Advanced: Configuration Provider
For advanced use cases, you can implement the INasaConfigProvider interface to supply configuration dynamically:
public class MyConfigProvider : MonoBehaviour, INasaConfigProvider
{
private NasaConfig _dynamicConfig;
public NasaConfig GetConfig()
{
// Create or modify config based on runtime conditions
if (_dynamicConfig == null)
{
_dynamicConfig = ScriptableObject.CreateInstance();
_dynamicConfig.ApiKey = PlayerPrefs.GetString("NasaApiKey");
// Set other properties
}
return _dynamicConfig;
}
}
Then use your provider with the client:
var provider = GetComponent();
var client = new NasaClient(provider);
Back to Top