Meta accounts are here: you can create a Meta account to log into VR devices. Learn more

WHEN EVENT IS RECEIVED

Codeblocks indented below when event is received will execute when called by a corresponding send event codeblock elsewhere.

Appearance in Composition Pane
Description

The when event is received codeblock is executed when it receives a data transmission called an “event” from either itself or a script attached to another object. This event can be called using a send event to object or send event with delay codeblock. It accepts up to three parameters.
Parameters

+ New Param
Can be any of the eight data types. The names given to these input parameters are local to the event. If you need to reference the parameter elsewhere within the script gizmo, use set to to assign its value to a variable declared in the Variables tab, as those variable names are local and available to the entire script.

The names of parameters being received must be different from the names of your declared variables. The parameters in the receiving event must also be in the same order as the parameters in the send event to object codeblock.


PREREQUISITE READING

WHEN WORLD IS STARTED precedes this tutorial


Example 1: Read an incoming string parameter

In this example, the myEvent event was previously sent by a send event transmission. It receives a string parameter, somestring. That parameter is then referenced in the Debug Print. Like in a traditional code function, the somestring name here is local to the when event is received event.