Skip to main content
‹ Back to Tutorials
Intermediate Unity

Unity Playmaker 2D Platformer - Teleport Player Point A to B

Dec 5, 2021
About this tutorial

In this Unity Playmaker 2D Platformer - Teleport Player Point A to B tutorial, I'll cover allowing the player to hit a key when they enter Point A to then go to Point B. I am using the case of a door to another room but this could be used for any type of transport system. (to Join my discord serve

Written Guide

This tutorial builds a reusable teleport: the player reaches a door, presses E, and is moved to a matching door elsewhere with a screen-fade transition. The trick is using tagged empty objects as point A and point B so the same logic works across any level without hardcoding coordinates.

Set up the two points

Place an empty (shown with a sprite) at the first door, name it point A, give it a point A tag, add a Box Collider 2D set to Is Trigger. Duplicate it for the second door as point B with its own tag. Using movable, tagged objects instead of fixed coordinates means the teleport logic can be reused in any level just by repositioning the points. Also prepare a black UI cover with an idle state and a cover fade animation that fades from black to clear.

Find the points and read their positions

On the player add a go through doors FSM with a Detect Doors state. Use Find Game Object by tag to locate point A and point B, storing each in a variable, then Get Position 2D on each (stored as point A pos and point B pos). Reading positions at runtime is what keeps the system flexible — move a point and the destination updates automatically.

Detect entering a door

Still in Detect Doors, add a Trigger 2D Event on the owner: entering the point A tag fires point A detected, entering point B fires point B detected, each routing to its own state. This lets the player arm a teleport only while standing in a doorway.

Teleport on key press with safe exit

In the point A detected state, use Get Key Down on E to send a move player event into a Move To Point B state, and add an Exit event (go back) returning to Detect Doors if the player walks away without pressing E. Move To Point B uses Set Position 2D on the owner to point B pos, then finishes back to Detect Doors. Mirror all of this for point B detected → Move Player To Point A.

Polish the transition and fix re-trigger

To stop the camera lurching, Activate Game Object to deactivate the virtual camera during the move and reactivate it afterward, with a short Wait (about 0.2s) before repositioning. Add Animator Play on the cover (state cover fade) just before Set Position so the screen fades as the player jumps. One bug to fix: after teleporting, the player is instantly standing inside the other trigger, so add On Trigger Stay 2D alongside On Trigger Enter 2D — detecting both 'entered' and 'already there' lets you hop back and forth reliably.

Unity tools by Bliz Studio
Built for our own games — now on the Asset Store

Multi Tag — unlimited hierarchical tags for any GameObject. Hierarchy Pro — style your whole hierarchy with rules. Made by a Unity dev, for Unity devs.

Explore our Unity assets →