Associate a Unity Scene and a Vortex Scene

Introduction

Just like the basis of a game level in Unity is a Unity Scene, the basis of a Vortex Simulation is a Vortex Scene. By associating the two together, you will be able to synchronize both scenes and keep them in sync.

  • Saving the Unity Scene will save the corresponding Vortex Scene

  • When the Unity Scene is opened in the Unity Editor, the Vortex Scene will be read and the Unity Scene updated

    • For synchronized objects, the hierarchy in the Unity Scene will be equivalent to the that in the Vortex Scene

    • Vortex extensions and objects will have their corresponding GameObject with the associated unity component

Once a Vortex Scene is Associated with a Unity Scene, both will work together and can exchange information.

While working in Unity Editor, it is tempting to open up Vortex Editor and have a look at the Vortex scene. While the Vortex Editor is opened and the Vortex scene is loaded, the Unity Editor will NOT be able to save the Unity Scene. Just closing the tab for the Vortex Scene in the Vortex Editor is enough to allow saving from Unity Editor.

It is also possible to associate prefabs to Vortex Mechanism, Assembly or Graphics Gallery. They will be automatically used when associating a Vortex Scene to a Unity Scene. See How to associate prefabs and Vortex documents in a Unity project.

 

Using the Vortex menu

Associating a Vortex Scene is done from the Vortex menu. Just select an existing Vortex Scene to associate it with the Unity scene. 

image-20240322-160840.png

If you want to create a new Scene, just use the “Create Vortex Scene” menu item.

Important Notes

  • A Unity Scene can only be associated to one Vortex Scene.

  • Vortex Scene game object will be created: it is the root of everything that will be synchronized between the Vortex Scene and the Unity Scene.

    • Any VHL related scripts, any graphics for Vortex controlled mechanisms, and other objects for Vortex features are added as children of the Vortex Scene game object.

 

After the Vortex Scene is selected from the file menu, it will be loaded and associated to the current Unity scene.

  • A Vortex Scene game object is created with the Vortex Scene component and will be the root for the Vortex objects in Unity

  • For each object in Vortex that can be associated with Unity, a game object will be created

The game object hierarchy under the Vortex Scene will be the same as the hierarchy of Vortex extensions and objects. That’s how corresponding objects are identified.

Game objects under the Vortex Scene can be modified and components can be added. However, the names of synchronized objects cannot be changed.

Game objects can be added anywhere in the Vortex Scene game object hierarchy. They will simply be ignored by the Vortex-Unity integration, but will work otherwise normally in Unity.

 

Association between Vortex extensions and Unity components

When a Vortex extension is associated with a Unity game object, the Unity hierarchy view shows a Vortex icon alongside the game objet.

Here is the list of extension-component that are used to synchronise Vortex and Unity.

Vortex extension

Unity component

Description of the Unity component

Vortex extension

Unity component

Description of the Unity component

Scene

VortexScene

The GameObject is usually called “Vortex Scene” and it is the root the synched hierarchy in Unity. Under the VortexScene, the hierarchy will be similar to the hierarchy in Vortex

VHL interface

VortexVHL

Get values from Vortex through VHL. On a master node (or in a standalone), allows to set values to VHL.

Graphics Spline (cable graphic display)

VortexSpline

Displays the cable spline

Mechanism

VortexMechanism

Root of an instance of a Mechanism document. Used in prefabs

Assembly

VortexAssembly

Root of an instance of an Assembly document. Used in prefabs

Graphics Gallery

VortexGraphicsGallery

Root of an instance of a Graphics Gallery document. Used in prefabs

Display (in the Setup document)

VortexViewport

In Play mode only, not under the Vortex Scene. Setup a camera according to the information in the Setup file and any Viewpoint that are defined.

Role

VortexRole

Not under the Vortex Scene. Any game object added under the Role, will be activate/deactivated as the Role gets activated.