0
Fixed

Teleport Player doesn't work "on key up" etc

Matthew Bockholt 1 month ago in Game Creator updated by Marti (Lead Developer) 4 weeks ago 3

When using the "Teleport Player" Action, it doesn't seem to work with Triggers that involve key presses. It will still rotate the player, so something is getting through, but the player doesn't teleport.

Teleport Bug 

Unity version:
2019.3.13f1
Game Creator version:
1.1.8
By Design

This is probably because the order in which scripts are executed. When you press Space, it first tells the character to Teleport to a certain position. However, in the same frame, it also tells the character to increase the height. The order in which these happen is unknown, but it will yield to different results.

An easy work around is to add a Wait of 0.1 seconds right before the Teleport. This will make the Action always run a few frames after the jump.

It's not just with space, it's with any key. I used space to show you that the key was for sure being pressed, but if you watch the video, I used tab first. I've tried lots of keys that aren't used for any other functions, none work, either with "On Key Down" or "On Key Up".

I did, however, try your suggestion, and added a "Wait" of .01 and it does work. How weird. I can't believe that this is "by design", though. Why should I have to add additional, unexpected, unintuitive, Actions to a simple Trigger => Action ( "On Key Up" => "Teleport Player" ) in order to get it to work? Why is a "Wait" not needed with "On Start" or "On Player Enter" to get the same Action to work correctly?

If you try, you can see that when using another key, say the H key, the camera will move a bit, as if trying to follow the player to the new location (another problem I'll bring up elsewhere), and the player will turn to face the correct direction that the "Teleport Player" Action prescribes, but the player does not teleport.

This seems to be a bug. If it is intended to work only with a "Wait" Action, then the "Wait" should be built into the "Teleport Player" Action.

Fixed

Seems we judge too quickly the issue. We assumed the Space key was conflicting the order to move the character. However, after testing again with other keys, the problem persists.

I've modified the Teleport action script so it accommodates to this limitation. You can download it here so you can try it right away. Unless the issue continues, this will be included in the next update.

6-teleport-fix.unitypackage

Cheers!