Next: , Previous: , Up: Motion   [Contents][Index]


12.22 Teleporter

Component: Teleporter

Teleporter allows players and objects to instantaneously travel from one place to another.

To teleport this object, supply a list of ’Tele Target Tags’ that this object can teleport to, or supply a ’Tele Target’ to make it go to one specific object, then call the appropriate message. To teleport another object instead, simply attach a collider to this object marked ’Is Trigger’ (found on the Collider component) and a list of both ’Tele Target Tags’ and ’Teleportable Tags’, the latter representing objects that can be moved using this teleportation trigger.

Field of Teleporter: List<string> teleTargetTags

A list of tags we can teleport to using the message ’TeleportToSelected’ which takes an integer representing the index of the tag you wish to use from the list and will teleport this object to an object with that tag.

Default value: new List<string>()

Field of Teleporter: bool automatic

If true, we will try to teleport any object that enters our trigger and has a matching tag

Default value: true

Field of Teleporter: GameObject splashPrefab

If supplied, we will spawn this at the entrance and exit position when teleporting. Does not use object pooling, so a new one is created each time this is used.

Field of Teleporter: MessageManager.ManagedMessage teleportMessage

Message sent when we activate the teleporter successfully

Field of Teleporter: MessageManager.ManagedMessage failureMessage

Message sent when we fail to teleport

Available Messages

Message on Teleporter: TeleportToTarget ()

Teleports this object to the supplied ’Tele Target’ scene object, if any.

Message on Teleporter: TeleportToNearest (string)

Teleports this object to the nearest object of a given tag.

Argument: Tag of the object we can teleport to.

Message on Teleporter: TeleportToRandom ()

Teleports this object to an object with a tag in the list of ’Tele Target Tags’

Field of Teleporter: List<string> teleTargetTags

A list of tags we can teleport to using the message ’TeleportToSelected’ which takes an integer representing the index of the tag you wish to use from the list and will teleport this object to an object with that tag.

Default value: new List<string>()

Field of Teleporter: bool automatic

If true, we will try to teleport any object that enters our trigger and has a matching tag

Default value: true

Field of Teleporter: GameObject splashPrefab

If supplied, we will spawn this at the entrance and exit position when teleporting. Does not use object pooling, so a new one is created each time this is used.

Field of Teleporter: MessageManager.ManagedMessage teleportMessage

Message sent when we activate the teleporter successfully

Field of Teleporter: MessageManager.ManagedMessage failureMessage

Message sent when we fail to teleport

Available Messages

Message on Teleporter: TeleportToTarget ()

Teleports this object to the supplied ’Tele Target’ scene object, if any.

Message on Teleporter: TeleportToNearest (string)

Teleports this object to the nearest object of a given tag.

Argument: Tag of the object we can teleport to.

Message on Teleporter: TeleportToRandom ()

Teleports this object to an object with a tag in the list of ’Tele Target Tags’


Next: , Previous: , Up: Motion   [Contents][Index]