Differentiating between platoforms

Randuman
25 Sept 2019, 18:31I'd really like my game's interface to work for both of and mobile, but things never show up the same as they're different dimensions and platforms. Is there a way I can have the game tell what platform it's on and display something different, or force the interface to be the same for both. Let me know if you have any ideas. Thanks!
mrangel
25 Sept 2019, 22:52If you run JS.whereAmI()
(I'm not sure if you actually need to do it, or if it's run automatically at some point), then the attribute game.questplatform
will be set to either desktop
, mobile
, or webplayer
. It won't change immediately; so I'd recommend checking if that attribute is already set, and if not call whereAmI and then create a script attribute game.changedquestplatform
, which will be run as soon as Quest gets a response from the frontend to recognise what kind of device it's on.
Alternatively, if you're already using javascript code to adjust the layout, you could have it look at the platform
javascript variable to see what kind of device it thinks it is on.

Randuman
26 Sept 2019, 04:42Thanks so much! I'll give it a shot. :)