Player Script component
Player Script allows you to use scripts to control players and devices.
Player Scripts can be used by calling ClusterScript.setPlayerScript()
in the Scriptable Item API.
Properties
properties | function |
---|---|
Source Code Asset | An asset can specify the script content that represents the item’s behavior. |
Source Code | You can directly specify the contents of the script that represents the behavior of the item. |
The content of the script is written in JavaScript.
Specify either Source Code Asset
or Source Code
. If both are specified, the content of Source Code Asset
takes precedence.
detail
Each item can have up to one Player Script component. They can also coexist with components of other types of items.
See Script Reference for APIs that can be used in scripts.
For sample code of Player Script, please refer to Variable _.
Other points to note
- Player Script don’t work in world preview