[Obsolete] Script
danger
The Script is Obsolete! Use LuaBehaviour
The script object references the Lua script that is attached to the game object. From the script, you access the underlying game object and the callback functions.
Members
Properties
Name | Description |
---|---|
Script .gameObject | The GameObejct which this script attached to. |
Script .id | A Unique identifier for this Lua script. This id is same for this script for all the clients in the room. |
Methods
Name | Description |
---|---|
Script .GetComponent(type) | Returns the component of Type type if the game object has one attached, null if it doesn't. |
Script .StartCoroutine(coroutineFunction, args) | Starts the passed function as a coroutine function. |
Messages
!!! note
Massive Loop follows a similar messaging system as unity. The messages that listed here are sent by this component and must be used in a similar way as start
or update
functions.
Name | Description |
---|---|
Script .FixedUpdate() | Frame-rate independent FixedUpdate message for physics calculations. Similar to Unity Fixed Update |
Script .LateUpdate() | LateUpdate is called after all Update functions have been called. |
Script .OnBecomeOwner() | Called when the current client becomes the owner of the object. |
Script .OnLostOwnership() | Called when the current client loses the network ownership of the object. |
Script .OnOwnerChanged(player) | OnOwnerChanged called when the current Network owner is changed. The new owner is passed as argument. Network ownership allows a certain client to modify properties of a game object if that game object or any of its parent or grandparents are synchronized using MLSynchronizer. |
Script .Start() | Called once at the beginning of the game. |
Script .Update() | Called once every frame. |
Example
do -- script Object
-- Get the reference for current script
local script = LUA.Script;
-- start only called at beginning
function script.start()
end
-- update called every frame
function script.update()
end
end