Commands Prefab

The Commands prefab object triggers your callback when a command occurs on the website. You can have multiple commands for the same Commands object. You need to modify the size of the Ids to have the number of commands required for your application. You can modify several properties in each element of this array:

../../../../_images/unity_GenvidCommands_short.png
Id
This is the name of the command. Make sure to use a unique name compared to the other commands used in your application.

On Command Triggered (String commandId, String values, IntPtr data)

The On Command Triggered function executes when the command triggers from the website.

  • commandId is the unique ID for the command.
  • values is the values sent with the command.
  • data is a is a unique pointer related to the specific callback.

In the Unity cube sample, we use the Commands prefab to be able to react to direction, speed, position, scene and camera changes. For each command, we look at the command values to get information about the changes to apply. We then apply the changes in game and we send back a notification to confirm having received the command.