Using shapes as the main UI for my game, is it a good idea?

Avatar
  • updated

Hello, I'm considering using shapes as the main API for building the UI in my game.

I'm worrying if this is advisable, since I'm not sure what are the impact on performance of 50 text elements + lots of rectangular and circular shapes all rendering at the same time. I want to use it both as the UI for the start menu and in-game menu of the game (buttons, settings page, etc...), aswell as the UI for world-space related UI entities (such as UI elements that follow in-game transforms).

Do you advise against this kind of usage? Or do you think it is fine? What are the limits of shapes in regards to how many elements should be rendered on the screen at any given moment in time? Any considerations that I'm not taking into account?

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Other
Avatar
Freya Holmér creator

It's hard to give general advice, because it depends on your target device and how your UI will function, as well as the ways you use shapes!

There's lots of info in the documentation on performance, I recommend reading through that pretty closely. It's certainly possible to make all your UI with Shapes, but it's also possible to do that in a way that won't work on lower end devices. For example, text elements can be very expensive if you use the immediate mode on-the-fly creation, but if you use the more recent cached text elements, then it will be significantly more performant. Spontaneously - those numbers sound like it should be fine!

But regardless, the best way is to performance test it yourself - set up a worst case scenario in terms of UI element count, and try it on your device, and see if it's acceptable :)