Add Command Prefabs to GenvidSession

A GenvidSession object with child streams added.

Commands let you tell your game to do specific things from a separate website, such as an administrator site.

Unlike events, commands go directly from the website to your game without a MapReduce system. This makes it possible to send individual instructions to the game with minimal delay.

Caution

We recommend limiting commands to an administrator or similarly access-controlled page.

Engine Integration

A GenvidCommands object.
  1. Drag and drop a Commands prefab into GenvidSession as a child of the GenvidSession.

  2. The GenvidSession has a Commands section. Drag and drop your current Commands prefab into this field.

  3. Change the Ids Size to the number of game-data streams that you want to create.

  4. Open one element and give it a unique name in the Id field.

  5. In the script receiving the command, create a public function that takes the following parameters in this order:

    • A string.
    • A second string.
    • An integer pointer.
    Events with ID set
  6. Drag and drop the object with your script into the On Command Triggered box.

    Events with ID set
  7. From the dropdown list displaying No Function, select the game script and function you created.

  8. In your public function you can use the information received from the command:

    • First String: Id of the command.

      Note: You’ll use this Id later when setting up your Commands configuration and website calls.

    • Second String: Results of the command.

    • IntPtr: Specific pointer used for the callback.

    The public function tells your game how to interpret commands sent from an external website. Commands are generally used for administrative functions and what they do is completely up to you. You can see examples of commands on the sample admin website.

Remember to implement your created commands in your website. You can find examples on the sendCommands page. The web-admin.js file in our Web Sample also illustrates this in more detail.

See also

Commands Prefab