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"

UGameplayStatics::OpenLevel Options custom params

Can I use UGameplayStatics::OpenLevel FString Options parameter to pass any values between levels? And if so - how it should be implemented? Where can i get this string?

Thanks in advance

Product Version: UE 4.9
more ▼

asked Feb 02 '16 at 05:27 PM in Using UE4

avatar image

8 2 3 6

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

1 answer: sort voted first


I just figured this out, here is how it works:

 1. UGameplayStatics::OpenLevel(this, "YourLevelName", false, "SomeVar=Value");
  2. On the GameMode derived class from the level you want to open you need to handle it like so:

  void [YourDerivedGameModeClass]::StartPlay()
       FString SomeVarValue = UGameplayStatics::ParseOption(OptionsString, "SomeVar");

I bet you can call this from any method defined in GameMode since "OptionsString" is set as soon as the GameMode is instantiated so you don't really need to call this on the StartPlay().

There are many other ways to get data on the GameMode, just check the GamePlayStatics class and you will find them, there is for example: GetIntOption() that will parse an int defined on the OpenLevel.

more ▼

answered Apr 25 '18 at 10:28 AM

avatar image

361 16 17 25

(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