Setting Variants#

This application communicates with Kit to set variants via button clicks from the web UI. This is accomplished via Action Graph with an On MessageBus Event node in conjunction with a Set Variant Selection node.

An example of this can be found for setting the background within the _onSelectBackground procedure.

Here is the step by step process on how to achieve this:

  1. Construct an AppStreamMessageType and provide an event type and a payload.

  2. Call AppStream.sendMessage with this data passed in. This payload is then sent to Kit.

  3. In the Action Graph, create an On MessageBus Event and provide an Event Name matching the event type sent to Kit in the previous step.

  4. Add an output on the On MessageBus Event node as a token attribute type. To accomplish this, select the node, then click Add+ under Add and Remove Attributes in the Property panel. The attribute name should match one of the keys from the payload sent to Kit via Appstream.sendMessage.

  5. Add a Set Variant Selection node to the Action Graph.

  6. Plug the new output into the Set Variant Selection node’s Variant Name input.

  7. Select the Set Variant Selection Node and:

  • Set the Prim that the variant exists on.

  • Set the Variant Set Name that the variant belongs to.

  • Check the Set Variant checkbox.

  1. Connect the On MessageBus Event’s Received output into the Set Variant Selection node’s Exec In input.

../_images/setting-variants_1.png