Teleport

Any gameobject that enters the collider2D on any gameobject with the Teleport component will be teleported to the specified destination. It is perfectly possible to create bidirectional teleports that work together.

../_images/TeleportGif.gif

Property

Destination

The transform where the gameobject will be teleported to.

Execute

If set to Automatic, the teleportation logic will execute immediately. If set to Button, you will need to set a reference to an InputButtonSO. Once the input goes active, the teleportation logic will execute. Please note, Teleportation is using Unity Triggers, so make sure the player’s RigidBody2D SleepingMode is set to Never Sleep, or the Teleportation on Button press will not work correctly.

LayerMask

Only gameobjects on this layer mask will be teleported.

Delay

Add a time delay before teleporting.

On Delay Start

The event invoked when the time delay begins. This only executes if delay is greater than zero.

On Teleport

The event invoked when a gameobject is teleported.

Important

You can easily set this up to teleport from room to room using rooms from the Safire Camera. You can also block player input during this process by calling BlockPlayerInput(bool value) with an event to WorldManager, and add a screen transition.