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.
Vortex notifies Unity of a feature that uses asset bundle
The data is coming from an extension in a Vortex document (mechanism, scene, graphics gallery, etc.)
Vortex Integration package in Unity will look for an Asset Bundle, and open it.
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
The Asset Bundle file should be in the same directory of the Vortex document the extension is coming from.
In the Asset Bundle, the Vortex Integration package in Unity will look for a prefab with a name that matches the extension name
Â
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:
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.Right-click the prefab. In the contextual menu, select Vortex > Export Asset Bundle...
Choose a destination folder.
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).
Make sure to place this file in the same folder as its corresponding Vortex asset file, with the same name too.
At this point, your asset bundle should be ready to be tested or used in a simulation.
Â