Spawn Asset Resource
For an overview of Resources, click here.
Deep Learning on Resources is found in Motive Academy. Click here to see the course this lesson is in.
Overview
The Spawn Asset Resource allows the author to spawn any type of asset instance into a Scene. The asset is spawned at the specified position.
The types of assets that can be spawned include:
Unity Assets
Binary Assets
Required Fields
Field Name | Description |
---|---|
Asset Instance | Specifies the asset to be spawned. Only Unity Assets can be attached to this field. The Assemblers will create these that include either one prop or most commonly a collection of props. These likely have the position built in. |
Optional Fields
Field Name | Description |
---|---|
Position | Specifies the position at which the asset should spawn and used if the Assembler has not set the position of the Unity Asset. This position can be one of two types: Fixed Position or Relative Position. The Fixed Position setting allows the author to configure the coordinates of the Positional Anchor, as well as its rotation. The Relative Position setting allows the author to configure the angle, distance, and elevation of the Positional Anchor, as well as its rotation. More information on positioning can be found here: |
Events
Using End Script Resource
If you use an End Script Resource in the same Script as this Resource, the Spawned Assets Resource will close - meaning they will disappear. An alternative to using the End Script Resource is to create a Custom Event marking the end of the Script and then use that Event as a Condition where needed in other Scripts. At Motive we commonly create a Global Event called “Assets Spawned” for use throughout the Project.
To learn more about Finishing Scripts, click here.
Example in the Headset
In the Motive Lab, I want to spawn the supplies, lab equipment, and more.
Add a Spawn Asset resource to the frame
Click on “Asset Instance” then “Asset” and you will see that the catalogs for any created Unity Assets appear:
Choose the Unity Asset
In my example, I’ve created several Spawn Asset Resources, and attached the Unity Assets to each:
It is very important to remember that you do not want to use an End Script Resource in a Script that has Spawned Assets. If you do, the assets will disappear. Instead, it’s recommended to create an “Assets Spawned” Custom Event that is Global, so that you can use it anywhere in the Project as a Condition:
Training Tip:
If you are spawning a large number of assets at once, it can lead to some stuttering in the headset. To mitigate the motion sickness that can result, you can fade the Scene out while the assets spawn. We also suggest using a Screen Message Resource to let the learner know what is about to happen.
In this example, here is what the Frames would look like with the Fade Out/In and Screen Message:
Here is what this would look like in the headset, complete with the Fade Scene and Screen Message tips:
To view this video in full screen, please click here.