I have created a Main Menu that can run in desktop or VR mode and allows the user to choose which way to run the game.
When I select desktop or VR mode, I load a new level want the Game Mode to spawn the appropriate pawn.
I have a post login event in game mode that spawns and possesses the pawns but my problem is telling the game mode which to spawn.
I have tried setting a boolean in the game mode from the Main Menu widget ‘bIsVR’ to true or false, but it seems that when ran from the client this isn’t possible.
I also tried saving this boolean to the GameInstance, but it looks like the GameInstance only exists on the clients and not the server.
I then tried saving this value to a game save, but again, the game mode is running on the server and doesnt load the game save from the client
I then tried setting level options open “levelname?vr=true” but again, this wasn’t set from the client side.
What is the best way of going about this? I can’t seem to get any option to work correctly.
Thanks for the reply.
I actually tried the options string, but this didn’t seem to work from the client side.
I used it on the open command when joining the server. Eg ‘open 192.168.0.101? vr=true’
This is Server only functionality, because this options are send to the GameMode, and there is not GameMode client-side.
You have two options:
When the client connects to the server, send that variable (OptionsString) to the client using the PlayerController for example
Instead of using OptionsString, save that data in your ULocalPlayer (create a UMyLocalPlayer) that is not destroyed when travelling.
Additionally, if you need to send that data to the server, you can override GetGameLoginOptions() to send that info to the host’s game mode at very first moment previous to the creationg of your Controller/Character server side.