ParaScript

Description

ParaScript is a user-generated content (UGC) component developed by ParaSpace. It achieves the capabilities similar to the Unity3D MonoBehaviour component, allowing you to create a prefab with logic code.

Property

paraObjectparaObject associated with the object
scriptLua table that stores the variables and functions defined in the associated script
scriptNameName of the Lua script associated with the object
updateOrderOrder of calling a script

Public method

SendMessageToOwnerSends messages to the network owner of the component.
SendMessageToAllSends messages to all the endpoints including yourself.
SendMessageToTargetSends messages to the endpoint where the specified player resides.
OwnerCallMakes a remote call to the specified function in the object owner’s script.
TargetCallMakes a remote call to the specified function in the specified player’s script.
RequestOwnershipRequests the network owner permissions of the object.
HasOwnershipJudges if network permissions are granted.
GetParaScriptGets all the ParaScripts of the component on a GameObject.
GetParaScriptsGets all the ParaScripts of the component on a GameObject, and returns an array of the same name.
GetOwnerGets the paraplayer that owns the game object.
SetOwnerSets the owner of the object. The function works only when the object is owned by yourself.
IsOwnerJudges if the specified ParaPlayer is the owner.
EnableInteractionEnables interactions. Both 3D and 2D interactions are supported.
DisableInteractionDisables interactions.
RespawnRespawns a ParaScript object and sets its position and rotation based on the initial state of the scene.
SendMessageToOthersSends network events to other players in a room.

Message

AwakeAwake is called when the script instance is being loaded.
StartStart is called on the frame when a script is enabled just before any of the Update methods are called the first time.
UpdateUpdate is called every frame, if the MonoBehaviour is enabled.
FixedUpdateFrame-rate independent MonoBehaviour.FixedUpdate message for physics calculations.
LateUpdateLateUpdate is called every frame, if the Behaviour is enabled.
OnBeginDragInterface to implement if you wish to receive OnBeginDrag callbacks.
OnDisableThis function is called when the behaviour becomes disabled.
OnEnableThis function is called when the object becomes enabled and active.
OnCollisionEnterOnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.
OnCollisionExitOnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.
OnTriggerEnterWhen a GameObject collides with another GameObject, Unity calls OnTriggerEnter.
OnTriggerExitOnTriggerExit is called when the Collider other has stopped touching the trigger.
OnNetSpawnedAfter the network properties of the object are initialized.
OnOwnershipRequestIf the function is defined in the script, you are notified when you receive an ownership transfer request on the object.
OnOwnershipTransferredYou are notified when the ownership is transferred.
OnUIPointerDownTriggered when the UI button or joystick is being pressed.
OnUIPointerUpTriggered when the UI button or joystick is being released.
OnUIPointerClickTriggered when the UI button or joystick is being clicked.
OnUILongPressTriggered when the UI button or joystick is being pressed and held.
OnUIDragTriggered when the UI joystick is being pressed and dragged.
OnFocusGets focus, and becomes the default interaction object.
OnLostFocusLoses focus.
On3DTouchBeginTriggered when an object is being pressed on the screen.
On3DTouchDragTriggered when an object is being pressed and dragged on the screen.
On3DTouchEndTriggered when an object is being released on the screen.
On3DClickTriggered when an object is being clicked on the screen.
OnInteractTriggered when a player interacts with the object, on which the basic interaction component needs to be mounted.
OnPlayerDropTriggered when the object is dropped by a player.
OnPickupTriggered when the object is picked up by a player.
OnTheftTriggered when the object is thieved by a player, or the API is called.
OnRespawnThe object respawns at a height lower than the threshold configured for the World currently.
OnSeatEnteredWhen a player takes a seat.
OnSeatExitedWhen a player rises from the seat and exits.
OnPlayerTriggerEnterFired when a player's capsule enters a Trigger Collider.
OnPlayerTriggerExitFired when a player's capsule exits a Trigger Collider.
OnPlayerCollisionEnterFired when a player's capsule enters a Collider.
OnPlayerCollisionExitFired when a player's capsule exits a Collider.
OnPlayerJoinedWhen a player joins the room.
OnPlayerLeftWhen a player leaves the room.
OnPlayerRespawnFired when a player respawns.
OnDestroyFired when the gameObject destroyed
OnCancelInterface to implement if you wish to receive OnCancel callbacks.
OnDragInterface to implement if you wish to receive OnDrag callbacks.
OnDropInterface to implement if you wish to receive OnDrop callbacks.
OnEndDragInterface to implement if you wish to receive OnEndDrag callbacks.
OnMouseDownOnMouseDown is called when the user has pressed the mouse button while over the Collider.
OnMouseDragOnMouseDrag is called when the user has clicked on a Collider and is still holding down the mouse.
OnMouseEnterCalled when the mouse enters the Collider.
OnMouseExitCalled when the mouse is not any longer over the Collider.
OnMouseOverCalled every frame while the mouse is over the Collider.
OnMouseUpOnMouseUp is called when the user has released the mouse button.
OnMouseUpAsButtonOnMouseUpAsButton is only called when the mouse is released over the same Collider as it was pressed.
OnPointerClickInterface to implement if you wish to receive OnPointerClick callbacks.
OnPointerDownInterface to implement if you wish to receive OnPointerDown callbacks.
OnPointerEnterInterface to implement if you wish to receive OnPointerEnter callbacks.
OnPointerExitInterface to implement if you wish to receive OnPointerExit callbacks.
OnPointerUpInterface to implement if you wish to receive OnPointerUp callbacks.
OnNetDestroyTriggered before network objects are destroyed.
OnSyncedVariablesUpdateTriggered when synchronization variables are updated.