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
10000 Update() calls - Unity Technologies Blog

Old but gold. Performance cost of calling unity magic methods and when you should think about using a custom update manager to save execution time.

https://blogs.unity3d.com/2015/12/23/1k-update-calls/

#performance
Progressing in Circles

A great article on different approaches for a circular progress bar with rough performance comparisons. All examples are provided with shaders.

https://medium.com/@bgolus/progressing-in-circles-13452434fdb9

#shader #progress #bar #circular
Preload Audio Data & How Unity Decides Which Audio Assets to Load to a Scene

The audio clip can be marked for preload in the import settings.
Preloaded audio clips are loaded with the scene when referenced on any gameobject in this scene.

https://medium.com/double-shot-audio/preload-audio-data-how-unity-decides-which-audio-assets-to-load-to-a-scene-a440a654e7e2

#audio #preload
Burst User Guide | Burst | 1.3.0

Burst docs and in-depth denoscription of optimization technics

https://docs.unity3d.com/Packages/com.unity.burst@1.3/manual/index.html#unityburstintrinsics

#burst #dots #jobs
Unity - Manual: GPU instancing

Tip: When writing shader noscripts, always use UnityObjectToClipPos(v.vertex) instead of mul(UNITY_MATRIX_MVP,v.vertex).

https://docs.unity3d.com/Manual/GPUInstancing.html

#shader #gpu #instancing #manual
Unity UI Performance tips - Sharing my findings

Limit the usage of 'Best Fit' and 'Rich Text' in Text components

Don't use dyanmic, use bitmap/static fonts if possible

Limit the usage of Outline/Shadow components on Text game objects. Bake the effect in the bitmap font instead

Stick to 'simple' sprites if possible. Avoid large 'tiled' sprites

Flatten out the transform hierarchy. The more nesting the more transform calculations needed to position children correctly

Uncheck "Pixel Perfect" in the Canvas settings. Big performance hitter.

Screen Space Overlay UI is slightly faster than Screen Space Camera. In Overlay the UI is drawn on top of the screen immediately avoiding all the culling and sorting that Camera space has to go through. (The performance hit shouldn't be that critical, and Screen Space Camera is convenient though, so maybe go with Camera and see if it causes you issues down the line)

Avoid stacking UI images/text on top of each other to best of your ability. This causes more overdraw and will slow things down

Subdivide your UI to multiple canvases based on what's static vs dynamically moving. Changing the position/rotation/scale/sprite/text of a UI element in a canvas causes a rebuild of the canvas' mesh for all its children. So having a single Canvas for the entire UI of your game is not a great idea. Divide it into logical groups that update/change together. e.g. Maybe each menu/screen/subscreen/popup has its own Canvas, maybe the hud top has a canvas vs the hud's bottom, etc.

General tip: Avoid Camera.main calls as it does Object.FindObjectWithTag every time it's accessed! Have a direct reference to the camera you're using instead.

Prefer enabling/disabling the canvas itself instead of the entire gameobject. Avoiding OnEnable/OnDisable callbacks on the entire hierarchy which could be expensive.

Avoid LayoutGroups. Roll out your own (see linked video for more details)

Updated pooled objects properties first before enabling it when borrowing an object from the pool. This avoids unnecessary dirtying of the object's hierarchy

With ScrollRects with many items, attach a Canvas (with no Pixel Perfect) to the scroll rect so that scrolling the items won't dirty out the elements in the outer canvases

Pool the items in the view. enable/disable elements as they get in/out of view

Clamp the velocity of the scrollview so that you don't end up with very small deltas making very small changes to your elements without it being apprently changing on screen

Turn off Raycast Target for static or non-interactive elements. This reduces the number of UI objects the collision/click/input raycast checker has to go through to determine what UI elements should receive events

Take out GraphicsRaycaster components from Canvases that don't require input events

Pack your sprites together to reduce drawcalls. Use Texture Packer or Unity's atlas/packer systems

https://forum.unity.com/threads/unity-ui-performance-tips-sharing-my-findings.524916/

#ui #performance #optimization #tips
Unity - Scripting API: Graphics.DrawMeshInstancedIndirect

Difference between Graphics.DrawMeshInstancedIndirect and Graphics.DrawMeshInstanced with examples

https://docs.unity3d.com/ScriptReference/Graphics.DrawMeshInstancedIndirect.html

#gpu #instancing
ArtStation - Tileable Liquid Mesh on Spline, Simon Trümpler

https://www.artstation.com/artwork/BmN5G6

#liquid #mesh #vfx
Laigter: normal map generator! - Lets Build Community 👩‍💻👨‍💻

https://letsbuild.gg/azagaya/laigter-normal-map-generator-2k12

#sprite #normal #map #generator