Features of the Vortex Unity integration requiring Asset Bundles

In order to simplify the use of the Unity with Vortex, we unified both workflow from the com.cmlabs.vortex.integration and from com.cmlabs.vortex.integration.standalone into the unified com.cmlabs.vortex.integration.unity. Some features of the integration require asset bundles.

In com.cmlabs.vortex.integration integration, Unity was only used as a renderer (meaning, one-way communication between Vortex and Unity), and the workflow was different. Asset bundles needed to be created and were loaded at runtime for each Vortex document. They could be loaded in the generic VortexUnityApp application, or in a custom Unity application.

For documentation on features of the integration with asset bundles, consult these pages:

Asset Bundles are ONLY available in Play mode in Unity.

How are Asset Bundles used for these features ?

Those features depends on the use of Asset Bundles and prefabs to instantiate the right unity objects at runtime. The principle is always the same.

Vortex objects must be associated to prefabs in Unity. Each Vortex object has a name and is part of the simulation's object hierarchy. A Unity Game Object hierarchy saved as an asset is called a prefab. Those prefabs must be exported into Asset Bundles, which are containers of Unity assets to be loaded at runtime. For any supported features, the Vortex Integration in Unity will look for a corresponding asset bundle containing a corresponding prefab. This prefab will then be instanced and updated every frame according to the Vortex simulation, depending on what type of extension it is. Generally, any change in the extension's inputs will be reflected in the instanced Unity GameObject corresponding to it.

  1. Vortex notifies Unity of a feature that uses asset bundle

    1. The data is coming from an extension in a Vortex document (mechanism, scene, graphics gallery, etc.)

  2. Vortex Integration package in Unity will look for an Asset Bundle, and open it.

    1. The name of the Asset Bundle file is the same name as the Vortex document containing the extension. For example, if a Earthworks zone extension is in Terrain.vxmechanism, the asset bundle file should be Terrain.unity3d

    2. The Asset Bundle file should be in the same directory of the Vortex document the extension is coming from.

  3. In the Asset Bundle, the Vortex Integration package in Unity will look for a prefab with a name that matches the extension name

Vortex hierarchy : the Graphics spline extension for the cable is passed to Unity. The Graphics extension is in the Hydraulic Turret Boom LB

 

4. The prefab found is instantiated and added to the Unity Scene.

5. At runtime, data from Vortex will be used by the game object instantiated.

 

Exporting into an Asset Bundle

When you are satisfied with a prefab, you can package it into an asset bundle, along with its related assets (these are the assets referenced by its different Components). A contextual action has been added to do exactly this.

A Unity Asset Bundle is a file that contains Unity assets to be loaded at runtime only (it cannot be edited). They can be loaded by any Unity application, which is a concept similar to how Vortex Studio asset files can be used in any Vortex Studio simulation.

Here is how to use it:

  1. First, find the desired assets in your Unity project, via the Unity Project window. This action is only available when selecting a prefab asset or a folder that contains prefabs.
    Note: this function also supports multi-selection, so many asset bundles can be created at once.
    In this example, we have cone assets (FBX file, textures, and a prefab) inside a "Cone" folder.

  2. Right-click the prefab. In the contextual menu, select Vortex > Export Asset Bundle...

  3. Choose a destination folder.

  4. The prefab and its related assets will be packaged into an asset bundle file, with extension .unity3d. Its name will be based on the selected prefab (or folder).

  5. Make sure to place this file in the same folder as its corresponding Vortex asset file, with the same name too.

  6. At this point, your asset bundle should be ready to be tested or used in a simulation.

Â