Components

These callback functions are available only on components. Components also have all the callbacks that exist in Main.

Function
Description

OnCollisionEnter(other: Object)

Called upon another object first colliding with the attached MapObject.

OnCollisionStay(other: Object)

Called every frame while another object is colliding with the attached MapObject.

OnCollisionExit(other: Object)

Called upon another object exiting collision with the attached MapObject.

OnGetHit(character: Character, name: string, damage: int, type: string, hitPosition: Vector3)

Called upon getting hit by a hitbox, such as a blade or titan attack. Only called if the MapObject has a collider of layer "Hitboxes" attached.

OnGetHooked(human: Human, hookPosition: Vector3, leftHook: bool)

Called upon getting hit by a hook. Only runs for your player character.

Network callbacks

The following callbacks are only available if the attached MapObject has the "Networked" option enabled in the map editor.

Function
Description

OnNetworkTransfer(oldOwner: Player, newOwner: Player)

Called upon the NetworkView changing ownership.

SendNetworkStream()

Called every frame for the owner. You can send a series of data, in order, by using self.NetworkView.SendStream.

OnNetworkStream()

Called every frame for every non-owner observer. You can receive the series of data, in order, by using self.NetworkView.ReceiveStream.

OnNetworkMessage(sender: Player, message: string)

Called upon receiving a self.NetworkView.SendMessage call.

Note that the OnNetworkMessage callback is separate from the one in Main: Main receives messages from the Network.SendMessage call, while components receive their own channel messages from the self.NetworkView.SendMessage call.

Last updated