How to Control Unity Lights from Vortex

The lights on a crane or an excavator is usually controlled by the operator. In order to have the lights in Unity controlled by the operator, a Vortex Light component can be created to receive the Vortex data and apply them to a Unity light. The Unity component will be connected to a Vortex Light extension, and changes to the Vortex light will be applied to the Unity light.

Only a few information will be applied to the Unity light

  • the on/off status of the light, corresponding to the Visible input of the light extension
  • the position and orientation of the light, corresponding to the input local and parent transform of the light.


The Vortex Light extension must have the Visible, Local transform and Parent transform connected to be able to control a Unity light.


Creating a Prefab corresponding to a Vortex Light

As for all Vortex extension that needs a corresponding Unity game object, the game objet will be instantiate from a Prefab, located in an Asset Bundle associated with the Vortex Document where the extension is located.


As usual, these two core principles apply for light:

  • Each controlled Vortex Light extension can have equivalent Unity prefab, with matching names.
  • This prefab must be located in the Asset Bundle file (.unity3d) at the same location and with the same name as the Vortex document.


The light extension in a Vortex document (here a mechanism), correspond to prefabs in a Unity asset bundle. We see that the corresponding prefab has the same name as the Light extension is will be connected to.


Creating a Vortex Light prefab

The creation process is very simple

  1. First, create the Unity light you need
  2. Then add a Vortex Light script component
  3. Finally rename the GameObject to have the same name as the Light extension in Vortex.

Any parameter of the light can be modified. The only Vortex information that will modify the Unity light is the Position, the Rotation, and the on/off state.


In this example, the Lights are part of a mechanism (named Excavator.vxmechanism). The prefabs will be contained in an asset bundle name Excavator.unity3d, and located in the same directory as the mechanism file. All the prefabs for the mechanism will be in the same asset bundle (cable, HUD, lights, etc). Use the context menu in the Asset folder containing all the prefab and their dependencies, to save the content of the folder as an Asset Bundle.