Game Development Reference
The position the player is transported to should be slightly outside the collider
of the destination teleport, as otherwise the player will get stuck in an endless
loop between transporters. This is why the x position has 1 added to it in
Listing 6.20 , although you could also modify the z position as needed.
If the player falls through the floor or ground plane after teleporting it will
be because the position he is teleporting to is below the ground plane.
Always ensure that the teleportation object sits above the ground plane
it is meant to be on.
Step 8. Select Sparkle1 in the Hierarchy, and in the Inspector set the to
variable in the teleportTo script to Sparkle2 as shown in Figure 6.17 .
FIG 6.17 Setting objects up for teleportation.
Step 9. Now do the same for Sparkle2 except set its to variable to Sparkle1.
Step 10. Play. You will be able to teleport back and forth between