Unity UI Tips

Organize using Empty gameObject.

Everything in the Unity UI can be organized inside an empty gameObject. UI elements that is similar should be grouped together under the same gameObject. Not only is this better for organization, it’s also useful when you want to turn certain elements on or off and making changes to them. Where instead of moving each UI element one by one, you can move the group and modify the group all at once.

Rect Transform Values

When moving and changing objects around, the position and width/height tend to end up with weird decimal numbers. Try to round up/down the numbers after you find a good location for them.

Don’t mess with Scaling unless needed by animation or for UI Scaling settings.

UI Scaling should ideally limited to giving the user the ability to change the UI size, if the default scaling isn’t 1, you’ll have to do extra math just to figure out how to scale things down easily. The other option is to use it for certain animations where the UI scaling is only temporally changed and will revert back.

Disable Raycast Target for Non Interactive Elements

If the element is not an interactive object, disabling Raycast Target can improve performance since Graphic Raycaster will check every frame for all the elements that is marked as Raycast Target.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store