For an overview of Resources, click here.
Overview
The Custom Event resource emits an event within a script. Frames can conditionally play if the custom event is specified using the Custom Event condition. This resource can be used for branching out a script.
The Custom Event resource is different from the System State or Story Point resources in that it does not use an enum. Furthermore, the author can specify the scope in which the custom event is called out. For example, the event can be local to the script, or global (in the session).
Required Fields
Field Name | Description |
---|---|
Custom Event | Specifies the name of the custom event. |
Events
Open, Activate, and Custom Event.
Example in the Headset
As described above, Events are like flags or markers that allow an author to note when things have happened and then trigger new parts of the scenario based on those events. In this script, we will use Custom Events to trigger when scripts open in the scenario. This is a simple example - but there may be any number of situations where you want to use the custom event to trigger something while authoring.
In this script, I want to create an Event that happens after the setup items are spawned in the environment. This is so that I can trigger the next script to run after the items are spawned.
Step 1: Create the Event
Open the appropriate script
Click on the Events tab. It is in a tab beside Resources:
Click +Add New
Name the Event - “Assets Spawned” (in this example)
Make the Event Global
Click the checkmark to save:
Step 2: Add this Event to the script
Now that the Event has been created, we want to add it to the script after the assets have been spawned.
In this example, I will click on the Spawn Assets Frame
Under the Workshop Props, click on the Event Link Shortcut
Choose Complete Event:
Choosing complete will open a new child frame under the “Spawn Assets” frame.
Rename the child frame - Assets Spawned Event:
Drag and drop the Event we just created into the Resources pane of the Assets Spawned Event frame:
Now, when the assets have spawned, we have marked it with an Event.
Step 3: Use Custom Event to trigger new Script Opening
Open the next script to be run in the Scenario. In this example, it is a PPE Script where a video will be played.
Drag and drop the Global Event you created into the Conditions pane of the script
Save
In the environment, you’d see the props in the scene spawn and then the video script will run.