Genvid Commands

The GenvidCommands prefab object triggers your callback when a command occurs on the website. You can have multiple commands for the same GenvidCommands 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/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.

Here’s an example on how we performed the speed change for the sample:

    public void OnCommandDirection(string commandId, string value, IntPtr uniqueId)
    {
        char delimiter = ':';
        string[] substrings = value.Split(delimiter);
        var cube = m_Cubes.Find(o => o.name == substrings[0]);
        if (cube != null)
        {
            cube.ChangeDirection(int.Parse(substrings[1]), int.Parse(substrings[3]));
        }
    }