Optional setup
The AffiseSettings builder (returned by Affise.Settings(...), Runtime/Affise.cs:41) exposes chainable methods for fine-tuning the initialization behavior before Start().
AffiseSettings builder
Section titled “AffiseSettings builder”Class: public sealed class AffiseSettings (Runtime/Settings/AffiseSettings.cs:9).
| Method | File:line | Purpose |
|---|---|---|
| SetProduction(bool production) | Runtime/Settings/AffiseSettings.cs:40 | Toggle production mode (default true, line 16). Set false to enable debug APIs. |
| SetDomain(string domain) | Runtime/Settings/AffiseSettings.cs:50 | Override tracking domain; trailing slash is irrelevant. Default: https://tracking.affattr.com/ (Runtime/Network/CloudConfig.cs:10). |
| SetPartParamName(string partParamName) | Runtime/Settings/AffiseSettings.cs:59 | Partner parameter name. |
| SetPartParamNameToken(string partParamNameToken) | Runtime/Settings/AffiseSettings.cs:68 | Partner parameter token. |
| SetAppToken(string appToken) | Runtime/Settings/AffiseSettings.cs:77 | Application token. |
| SetOnInitSuccess(OnInitSuccessHandler) | Runtime/Settings/AffiseSettings.cs:86 | Success callback. |
| SetOnInitError(OnInitErrorHandler) | Runtime/Settings/AffiseSettings.cs:95 | Error callback. |
| SetConfigValue(AffiseConfig key, Object value) | Runtime/Settings/AffiseSettings.cs:104 | Single typed configuration entry. |
| SetConfigValues(Dictionary<AffiseConfig, Object>) | Runtime/Settings/AffiseSettings.cs:113 | Bulk configuration entries. |
| SetDisableModules(List<AffiseModules>) | Runtime/Settings/AffiseSettings.cs:126 | Disable specific modules at runtime. |
| Start() | Runtime/Settings/AffiseSettings.cs:172 | Finalize configuration and boot the SDK. |
AffiseInitProperties
Section titled “AffiseInitProperties”Backing DTO produced by the builder — public class AffiseInitProperties (Runtime/Init/AffiseInitProperties.cs:13).
| Field | Type | Default |
|---|---|---|
| AffiseAppId | string | required constructor argument (line 15) |
| SecretKey | string | required constructor argument (line 17) |
| PartParamName | string? | null (line 19) |
| PartParamNameToken | string? | null (line 21) |
| AppToken | string? | null (line 23) |
| IsProduction | bool | true (line 25, ctor default line 45) |
| OnInitSuccessHandler | OnInitSuccessHandler? | null (line 27) |
| OnInitErrorHandler | OnInitErrorHandler? | null (line 29) |
| ConfigValues | Dictionary<AffiseConfig, Object> | empty dictionary (line 31) |
| DisableModules | List<AffiseModules> | empty list (line 34) |
| Domain | string? | null (line 40) |
Public method Copy() returns a duplicate AffiseInitProperties (Runtime/Init/AffiseInitProperties.cs:129); ToJson property yields the JSONObject (line 131).
Custom domain
Section titled “Custom domain”Domain override uses SetDomain(string):
Affise .Settings( affiseAppId: "Your appId", secretKey: "Your SDK secretKey" ) .SetDomain("https://YoureCustomDomain/") // Set custom domain .Start(); // Start Affise SDKInit success / error callbacks
Section titled “Init success / error callbacks”Delegate types:
public delegate void OnInitSuccessHandler();(Runtime/Settings/OnInitSuccessHandler.cs:3)public delegate void OnInitErrorHandler(string error);(Runtime/Settings/OnInitErrorHandler.cs:3)
Wired via SetOnInitSuccess (Runtime/Settings/AffiseSettings.cs:86) and SetOnInitError (Runtime/Settings/AffiseSettings.cs:95).
Example (from; README mislabels the fence as dart, content is valid C#):
Affise .Settings( affiseAppId: "Your appId", secretKey: "Your SDK secretKey" ) .SetOnInitSuccess(() => { Debug.Log("Affise: init success"); }) .SetOnInitError((error) => { Debug.Log($"Affise: init error {error}"); }) .Start(); // Start Affise SDKBehavior (Runtime/Affise.cs:46-71):
- On a duplicate
Start()call the error handler is invoked withAffiseError.MESSAGE_ALREADY_INITIALIZED. - In the Editor path,
OnInitSuccessis invoked afterAffiseComponentconstructs successfully; a thrown exception routes toOnInitErrorwithe.StackTrace. - On device, the native bridge constructs
AffiseNative; the Unity-side success handler is not invoked explicitly inRuntime/Affise.cs.
Disable modules
Section titled “Disable modules”Use SetDisableModules(List<AffiseModules>) to turn off bundled modules. Example:
Affise .Settings( affiseAppId: "Your appId", secretKey: "Your SDK secretKey", ) .SetDisableModules(new List<AffiseModules> { AffiseModules.Persistent, // Disable module programmatically for iOS AffiseModules.AndroidId, // Disable module programmatically for Android }) .Start();See Modules for per-module effects.
Debug mode
Section titled “Debug mode”Setting production false enables debug APIs accessible via Affise.Debug (typed IAffiseDebugApi, Runtime/Affise.cs:263):
Affise .Settings( affiseAppId: "Your appId", secretKey: "Your SDK secretKey" ) .SetProduction(false) //To enable debug methods set Production to false .Start(); // Start Affise SDK
Affise.Debug.Validate(status =>{ // Handle validation status});IAffiseDebugApi (Runtime/Debugger/IAffiseDebugApi.cs:7):
| Method | File:line |
|---|---|
| Validate(DebugOnValidateCallback) | line 14 |
| Network(DebugOnNetworkCallback) | line 21 |
| Version() → string | line 26 |
| VersionNative() → string? | line 31 |
Version() returns "1.7.7" (Runtime/Debugger/AffiseDebug.cs:51).
Enum ValidationStatus (Runtime/Debugger/Validate/ValidationStatus.cs:6) — VALID, INVALID_APP_ID, INVALID_SECRET_KEY, PACKAGE_NAME_NOT_FOUND, NOT_WORKING_ON_PRODUCTION, NETWORK_ERROR, UNKNOWN_ERROR.
Troubleshooting
Section titled “Troubleshooting”iOS: pod install fails on AffiseInternal
Section titled “iOS: pod install fails on AffiseInternal”If a Podfile has not been generated, copy Editor/Resources/iOS/AffisePodfile.rb as a starting template.