Don't use UICorner for just rounding frames, you are killing performance

Let me make this short, UICorner isn’t as good as you think.

Yes it may sounds like a revolutionary feature for you, but in reality, it really isn’t.

If you look at a frame that is rounded by UICorner, you can see the frame, is no longer sharp, but “blurry”.

Ok, that’s expected but the main problem is, there’s performance overhead, like really serious for budget devices like android-go based phones (low-range phones with low specs like single core, 1-2gb ram and 16gb flash etc)

If you aren’t using UICorner to apply roundness to “unexpected” image assets (eg player avatar), or anything that 9-slice technically can’t achieve, please stop. You are killing performance by this. You might not sense the performance difference, but with low spec, you will.

So, what’s the solution? Use 9-slice. Yes, you get the same result, but there’s a catch to it:

You will be ensuring that UI won’t kill the performance for budget devices, which UICorner won’t.

Only if Roblox managed to optimize it and it won’t cause any large performance overhead, then use it but otherwise, don’t unless there’s reasons.

Here’s the pros and cons of UICorner and 9-slice.

UICorner pros:

  • It’s easier to achieve, for beginners

Cons:

  • Performance overhead
  • Can’t clip
  • You can’t have different corner size with UICorner itself only
  • The result is somewhat pixelated

9-slice pros:

  • You won’t get any performance overhead from it
  • You can have different corner size in some cases

Cons:

  • You can’t clip directly, you have to do some maths or use a simple cutout image, that can be 9-sliced.
  • Some people find it hard to use
  • The result is same as UICorner’s, pixelated.

Thanks. :heart:

6 Likes

Thanks! Almost all of the GUI’s in one of my games were using UICorner. Now I know why it had lag :sweat_smile:

2 Likes

All of this information was already made available on the original UICorner thread… what was the point of this?

3 Likes

Do you have some stats or tests to show the impact it has on performance? How many UICorners until framerate gets impacted, and to what degree with respect to the system specs? Does modifying UICorner’s properties impact the change in performance as well?

2 Likes

Wow, you’re right. This is nearing straight-up plagiarism.

3 Likes

It’s to raise awareness that you shouldn’t be using it for just making object rounded as it’s a bad practice to do so, which I’ve seen several, well, a lot of people suggesting UICorner for making UI objects to be rounded without realizing how performance-intensive it is.

This isn’t a duplicate of the original announcement, but instead this is to warn developers not to abuse this class, as it could get really horrible and can potentially ruin your game if overused. (Which, seems like nobody really cared about the announcement that states it has performance overhead, and decided to use it for every UI components.)

I must say this topic is a bit sketchy as it does sounds like a copy of the original announcement regarding UICorner, but there’s one difference, the announcement never mentioned about the suitable use cases for UICorner (for the time being), only stated its advantages, disadvantages and examples of UICorner. Which in this topic is to let users know what’s the actual use case for UICorner and to inform user to not use UICorner for something that can be achieved by 9-slice, and the result is nearly the same as UICorner’s

In short form, what I am implying is there is no point using UICorner unless when it’s for something that is not pre-made

It would be useful to tell people really how resource-intensive it is.

In programming there are many people that describe certain things as “resource-intensive” but really it just takes a few more microseconds to do than their solution.

How much impact does it actually have? A few numbers would be great and an explanation of those numbers.

1 Like

I haven’t conducted a very serious benchmark (I don’t have a low-end device to be used for test) for it but considering the announcement says that there has a performance overhead and UI that is being active (visible in screen) will be rendered per frame, which is also rendered while the game is rendering itself and characters. (UI renders in Roblox’s own engine, not the device’s API) Which is obvious that it can potentially have fps drops if your computer or device isn’t capable of doing it at once, around 5-15fps, but really depends on the UI complexity and your game’s scene.

It isn’t really an issue for mid-end and hi-end users, but for low-end, this could be an issue, well, a threat.

If your game is meant to be for mid-end and above, you don’t really have to take this issue seriously, but it can happen eventually (if your game kept being larger and larger).

I am not very sure whether this is useful or not, but while I was having a talk with another developer, they’ve mentioned that Tiffnix said it (UICorner) won’t happen due to performance implications. Even though Roblox have managed to make this into a feature, it is very likely that they just forgot about the low-end and decided to make it anyway.

My advice would be to change your post to only include information that’s not able to gleaned from the original announcement thread.

This is plagiarized from the original UICorner post.