Should I have a different ScreenGui for each platform?

,

The GUI for all the platforms are going to vary quite a bit. The GUI for Xbox will need to be different than the GUI for a Phone.

What I was thinking was I’d determine what platform the user is on, then clone/parent or enable the correct GUI for the Player. I’d only use one localscript so there wouldn’t be duplicate code.

The only downsides I see are:

  1. Certain elements of the GUI will be duplicated
  2. I’ll have to do checks when creating events for things that only appear on Phone so that the client doesn’t error if a player is on an Xbox or PC.

Should I do this? Or are there any other downsides I haven’t thought about

2 Likes

Why not just move/resize elements around the screen when the input mode / screen size changes? Modern games are reactive to such changes, not stuck to one particular input type / window size depending what the user launched with.

3 Likes

Because I’m not smart enough to do that and this seems easier

I can’t imagine someone launching a game on PC then somehow it magically switches to an Xbox or Phone without exiting the game.

I’m assuming your Xbox layout will be similar to PC + controller. So if the player is playing with keyboard first and then plugs in a controller and plays with that, ideally your game should react to that. Or if I’m playing on a 2-in-1 laptop (with a touch screen), I’d probably want to see different input hints when I start using touch to play the game.

You can find out when the input type changes by listening to UserInputService.LastInputTypeChanged.

3 Likes

Good point.

Simply answering the question asked in the title, yeah not all GUIs work on all platforms, I’ve noticed that overtime.

It’s best to make sure either yeah, they’re different, or just to be sure they work for all platforms.

*if this isn’t what you were asking then i’m sorry haha.

I advise that you check a few things inside a script to determine exactly what kind of GUI objects to display on the client’s screen. I prefer to check if touch is enabled, and that the screen resolution is within a certain range. you can do that by using this, and by making a Frame inside of a GUI object have the size of (1, 0, 1, 36). This basically gives you the size of the player’s screen, thru the use of AbsoluteSize, in addition to checking if they have touch.

Personally, I’d create different ScreenGui containers, with all of them being in some storage, probably ReplicatedStorage. When you know what kind of platform they’re most likely using, just snag a clone from ReplicatedStorage, and plop it into the PlayerGui.

1 Like

This is slightly over-engineered. You can get the view port size through i.e. Camera too without needing extra objects: https://developer.roblox.com/api-reference/property/Camera/ViewportSize

Subsequently you use GetGuiInset to get the space that the topbar subtracts from the screen: https://wiki.roblox.com/index.php?title=API:Class/GuiService/GetGuiInset

2 Likes

While having a different ScreenGui for each platform may sound nice, I think it would bring a few caveats if you chose this:

  • You would, of course, need to go through the process of creating a ScreenGui for each platform that you plan to support.
  • You would have to make various checks such as Input, etc. via script (if you intend on having input in some of the GUIs) which could be rather tedious.

But as an answer to the OP, I think it should come down to using what you currently have, but making sure your GUIs can fit on most devices you intend on supporting. Of course, XB1 could be an exception,

TLDR; I recommend trying to play around with Size variables for your GUIs so they can have “uniform scaling”. Hope this helped!

No. You should make one UI that is designed with all the platforms you want to support in mind.

This is much easier than manually making a new UI scheme for each platform and is what professional games do.

You would ideally only need to make a few changes depending on what input is being used, like maybe change text or something. If you need to do bigger things, you might be better off changing the whole UI design in general.

Good luck :slight_smile:

1 Like