Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to Open Level and Set Player Position?

I'm working on a 2D sidescroller with different levels. I have created a save game system which allows me to save the position of the player and what level he is on.

When you load the game, the saved last level opens and the player is teleported to the saved location. It should be so.

Unfortunately, the player always starts at the Player Start object. If I do not open the level and only teleport the player, it works. But only if I start from this level.

Sorry for my bad English. I am happy if someone can help me. :)

Load Game Action Save/Reset Game Action Load Game Function Save Game Function Save Game Blueprint

Product Version: UE 4.21
1.png (124.9 kB)
2.png (176.8 kB)
3.png (246.5 kB)
4.png (33.8 kB)
5.png (250.7 kB)
more ▼

asked Feb 11 '19 at 12:56 PM in Blueprint Scripting

avatar image

5 1 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

There are 2 issues with your game calling Teleport event. First, when you load a level, your Pawn isn't created yet. Second you are calling Teleport before GameMode's InitStartSpot occurs which is responsible for choosing where PlayerStart and spawning your Pawn in its location.

Try moving your call to Teleport event during GameMode's BeginPlay. That way, you're sure that your Pawn is already created and spawned before teleporting him where he should be. You probably want to call Teleport when you know you loaded a level, so you may need some extra variables to take care of that.

more ▼

answered Feb 11 '19 at 01:53 PM

avatar image

1.2k 8 4 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question