I have a level I wish to open from a menu that can work with two game modes- PlayMode and TutorialMode. I know how to switch between these in the editor’s World Settings, but is there a way to open the level with either of those modes, depending on whether the user clicked “Play” or “Tutorial”?
Figured out how to use the OpenLevel function’s Options parameter (didn’t notice the option was available :P):
?game=ProtoThree.TutorialMode -game
Where ProtoThree is my project’s name, and TutorialMode is the game mode I wished to use.
So did you fix your problem? I don’t believe there is a way to change the game mode after the level has been loaded.
Yep That’s what I was after. Posting my solution here for the benefit of other people with the same problem.
Thanks, this worked perfectly for me!
Just to clarify further, since I couldn’t find elsewhere what to pass as the other arguments to OpenLevel(), I used:
- The return of
GetWorld()
forWorldContextObject
- The name of the level you want to enter for
LevelName
(eg. “/Game/LevelName” if the level is in your projects top level Content directory) -
false
forbAbsolute
(since I believe passing true will causeOptions
to be ignored, and therefore I am unsure if the game level would be loaded, but I didn’t test this) - “?game=ProjectName.GameModeName -game” for
Options