Everyday Unity – Telegram
Everyday Unity
1.1K subscribers
157 photos
59 videos
42 files
2.36K links
A game developer and tech lead in a top grossing company posting Unity, programming, and gamedev related stuff that I find interesting
Website: https://gamedev.center

Most used tags are:
#performance
#shader
#interview

Author: @alexmtr
Download Telegram
Avoid too many dynamic lights when you use forward
rendering. Every dynamic light adds a new render pass
for every illuminated object.

#rendering #tips #lighting
Try to avoid Layout Groups where possible, especially
if your content isn’t really dynamic. In cases where
Layout Groups are only used to perform the initial layout
of content, which subsequently doesn’t change, then
consider adding some custom code to disable those
Layout Group component(s) after the content has
been initialized.

#ui #tips #layout
List and Grid views are another common UI pattern (e.g.,
inventory or shop screens). In such cases, where there
may be hundreds of items with only a small number
visible at once, don’t create UI elements for them all, as
it will be very expensive. Instead, implement a pattern
to reuse elements and bring them into view on one side
as they move off the other side. A Unity engineer has
provided an example in this GitHub project.

Repo: https://github.com/boonyifei/ScrollList

#ui #tips #scrollrect
It is common to see UIs with areas constructed of many
overlaid elements. A good example of this might be a
card Prefab in a card-battler game. While this approach
allows for a lot of customization in designs, it can
greatly impact performance with lots of pixel overdraw.
Furthermore, it may result in more draw batches.
Determine if you can merge many layered elements into
fewer (or even one) elements.

#ui #tips #overdraw
Mask and RectMask2D components are commonly
found in UI. Mask utilizes the render target’s stencil
buffer to draw or reject the pixels being drawn, bearing
the cost almost entirely on the GPU. In contrast,
RectMask2D performs bounds-checking on the CPU
to reject elements outside of the mask. Complex UIs
with lots of RectMask2D components, especially when
nested, can incur significant CPU costs in performing
the bounds checks. Take care not to use excessive
numbers of RectMask2D components, or if GPU load is
less than CPU load, consider whether it is preferable to
switch to Mask components to balance the overall load.

#ui #tips #mask #rectmask2d
In most cases, mipmaps are not required on UI textures,
so ensure that this Import Setting is disabled on them
unless you specifically require it (for world-space UI,
for instance).

#ui #tips #mipmaps
Be sure to disable the Raycast Target option on UI
Graphic elements that don’t need to receive input
events. Many UI elements don’t need to receive input
events, such as the text on a button or non-interactive
images. However, UI Graphic components have the
Raycast Target option enabled by default. Complex UIs
could potentially have a large number of unnecessary
Raycast Targets, so disabling them can save significant
amounts of CPU processing.

#ui #tips #raycasttarget