Define a decision
A decision is a point where your game asks PIO to choose an option. See the quickstart for the SDK naming. Define each option through payload parameters and read them with compiled defaults. Define the decision in the dashboard, where its default option becomes the fallback that code generation bakes intoPioActions.All. Register the same key in PioConfig.Actions with a FallbackAction, the option your game uses when the backend is unreachable.
Requesting
PIO.GetDecision(key) returns a Baseline result without a payload when tracking is disabled or the SDK is not ready. An unregistered key throws ArgumentException when ready and tracking. Each call auto-emits a decision event and increments a per-action counter included in future state snapshots.
Reading the result
Set each field’s default in the dashboard to what your game does today, then generate code (PIO > Generate Code Constants). Read the decision through the generated class:
Samples~/BasicIntegration/Assets/Scripts/GuideExamples.cs
If your game already decides this another way
If today’s decision comes from your own logic, such as segment rules, another model or another provider, keep running it whenever PIO has no payload:Samples~/BasicIntegration/Assets/Scripts/GuideExamples.cs
d.Action is a label for logs. Don’t use it to choose what to do.
Cancelling your own token rethrows OperationCanceledException.
Where decisions run
Decisions run on the device whenever it can execute your model, and in the cloud when it cannot. There is no setting for this. After initialisation, the SDK downloads the current model and serves decisions locally, with no network round-trip. Any decision the device cannot serve goes to the cloud, which uses the same model, the same option limits and the same retirements.Source is Worker for both, because the model sampled the option either way. Your payload reads stay the same.
A decision goes to the cloud when:
- the model has not finished downloading yet, which is common for the first decisions after install
- the platform has no on-device runtime, for example an x86 Android emulator
- the downloaded model failed its integrity check
- the model needs a newer SDK than the one in your build
- the on-device run failed, in which case the same decision is retried in the cloud
EnableDebugLogging on PioConfig. Each decision then logs a decision routing line naming the reason. A cloud-served decision costs a network round-trip and is bounded by DecisionTimeoutMs. That round-trip is the usual cause of a decision that is slower than expected.
Payloads
An option can carry payload parameters, such as enemy health, copy or discount percentages, edited in the dashboard and delivered with the decision. The model chooses among the options and learns from their payload fields. Read those values with defaults compiled into your game. Adding an option needs no app release when it uses parameters and behaviour your integration already supports. See Action spaces & payloads for when new options become available.Samples~/BasicIntegration/Assets/Scripts/GuideExamples.cs
GetInt, GetFloat, GetBool and GetString for single values; GetIntArray, GetFloatArray, GetBoolArray and GetStringArray for lists; GetJson(key, default) for nested data. The API reference documents the generated classes and the schema-drift warning.