Click CREATE at the top of the Actions Management page to go to a form that lets you create a new game parameters action.
The action name panel lets you give your action a descriptive, relevant name and contains 3 buttons that:
- Create a new action
- Open an existing action
- Clone an existing action to a new action, useful if you’re setting up multiple similar actions.
Persist between sessions control
If the “Persist between sessions” toggle switch on Event-triggered campaign actions is set to FALSE, the player will need to record the trigger event on the next campaign if they want to see the campaign action, or the campaign will be lost. They have one chance to trigger the campaign. Conversely, if the “Persist between sessions” switch is set to TRUE, the player can trigger the campaign action on the next or any subsequent session, while they still meet the segmentation criteria.
Game parameters panel
The Game Parameters panel lets you add one or more parameters to your action and assign them values that will be passed back to the game if this action is triggered. Specify key-value pairs that can be sent back to the game client here.
The parameter drop-down list contains all your game parameters. You can use the Game Parameter Manager in the Setup section of the platform to create additional parameters if you need to. You can then add a value for the parameter. The value can be populated by:
- The contents of a user metric
- A piece of localized content
- A static value
If your parameter is an Enumerated or Boolean type the value entry box will only let you add an acceptable value.
The “Return on every engage response” checkbox lets you specify if this game parameter action should be returned on every successful engage response or only as the player enters the campaign step that this game parameter action is attached to. By default, game parameters will be set to return on every response.
The buttons on the Game Parameters panel are used to add additional parameters or remove existing ones.
Finally, don’t forget to save your action.
Your action will also be available for use when you’re setting up campaigns.
When a game parameter action is triggered by a campaign the resulting parameters will be passed back to the game in the parameters section of the Engage response.
Your action will also now be available for use when you are setting up campaigns.
When a game parameter action is triggered by a campaign the resulting parameters will be passed back to the game in the parameters section of the Engage response.
1 2 3 4 5 6 |
{ "transactionID": 2092940750802923500, "parameters": { "missionDifficulty": "EASY" } } |
To access the callbacks provided with the Unity SDK see the following code:
Declare a game parameter handler.
1 2 3 4 5 |
DDNA.Instance.Settings.DefaultGameParameterHandler = new GameParametersHandler(gameParameters => { // do something with the game parameters myGameParameterHandler(gameParameters); }); |
Extract the parameters from the response.
1 2 3 4 5 |
private void myGameParameterHandler(Dictionary<string, object> gameParameters) { // Generic Game Parameter Handler Debug.Log("Received game parameters from Engage campaign: " + DeltaDNA.MiniJSON.Json.Serialize(gameParameters)); } |
For the Android SDK and the iOS SDK, the code snippets required can be found in the ReadMe file in the linked GitHub repositories.