Download

How to compile both VR(default 1stPerson view) & Mobile(3rdPerson view) from one same project and source code?

how to compile both VR(default 1stPerson view) & Mobile(3rdPerson view) from one same project and source code?
Thank!

Easiest is probably to have a parameter that you check in your game mode that selects the player controller class based on whether it’s set as “VR” or “Mobile.”
Then, set that parameter, either using different ini files with different targets, or at runtime by introspecting the environment, such that the GameMode selects the right PlayerController which in turn knows how to do the rest.
If you want to use different Pawn classes in the different modes, too, then you’ll want to override the default-pawn-class-chooser function in GameMode, because the base GameMode will just let you pick one.

Thank you very much !

VR and MobilePhone are both Anroid, so how to seperate them into different StartPlayer state?

i tried to create 2 pawn and later(after GameMode constructor) set them to DefaultPawn, but not workd. because only can know whether VR or not by HMD info after GameMode constructor, but set DefaultPawn outside constructor seems not work…

Presumably you have some kind of early loading game mode that doesn’t actually “start” a “game” with a “pawn” – there’s some kind of introductory scene or menu or somesuch? That one can figure out what to do, and then set appropriate properties in something like the GameInstance, which your next GameMode can then pick up and use.