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
Writing Shader Code for the Universal RP

Shaderlab
HLSL
Structs
Vertex Shader
Fragment Shader
Keywords & Shader Variants
Lighting Introduction
PBR Lighting
ShadowCaster & Depth Only Passes
Summary of Built-in vs URP differences

https://cyangamedev.wordpress.com/2020/06/05/urp-shader-code/

#shader #urp
How can I achieve simulated fluid surface deformation in a bottle? Like in the Half-Life: Alyx

https://gamedev.stackexchange.com/questions/182989/how-can-i-achieve-simulated-fluid-surface-deformation-in-a-bottle

#liquid #breakdown
Introducing the Editor Iteration Profiler - Unity Forum

High-level features summary
Monitor and capture profiling data from assembly reload, assembly compilation, and enter playmode.

Export captured data or Profiler data to a number of formats such as HTML, JSON (for chrome://tracing, which is a fast flame-graph style data visualizer), CSV, and Plaintext.

Export to a special type of HTML (HTML Performance Report), which attempts to minimize the number of clicks needed to get to the important areas of the profiled data, as well as aggregate possible areas of interest which could be optimized (e.g. OnEnable calls)

https://forum.unity.com/threads/introducing-the-editor-iteration-profiler.908390/

#eip #editor #iteration #profiler
The danger of async/await and .Result in one picture – TooSlowException

https://tooslowexception.com/the-danger-of-asyncawait-and-result-in-one-picture/

#async #await #deadlock
After long adventures and frustrations with UGUI, I can say with confidence that reading the source code helps better than official documentation. There are many "not a Bug, but rather a feature by design" things, won't be fixed in current HorizontalOrVerticalLayoutGroup

To avoid using ForceRebuildLayoutImmediate or/and some manual update workarounds, the following approach works well:

Both "child controls size" checkboxes must be enabled and "child force expand" disabled for all ILayoutController (Horizontal, Vertical, also for nested ones), then to control the dimension of the objects you simply use the LayoutElement component (min, pref, flex sizes). As a result, any dynamic content is correctly aligned, regardless of the activation/deactivation/addition/removal of neighbors.

Note 1: There is no need for ContentSizeFitter component for GameObjects, that are first level children of any LayoutGroup. The main thing is to correctly set the checkboxes, as described above. However ContentSizeFitter may be useful for top level container, or children of children that are not directly controlled by any LayoutGroup.

Note 2: Minimize LayoutGroup nesting when possible. Layout rebuild is very expensive. More info on topic:
Unite Europe 2017 - Squeezing Unity: Tips for raising performance.

https://forum.unity.com/threads/force-immediate-layout-update.372630/#post-5604151

#ugui #ui #layout #optimization #performance #force #rebuild
float val = smoothstep(_Radius + _Blend, _Radius, UVDistance) * _CellBuffer[i].z;

Smoothstep работает следующим образом: если переменная «UVDistance» больше, чем "_Radius + _Blend", то она возвращает 0. Если переменная меньше, чем "_Radius", то она возвращает 1. Между ними значения плавно интерполируются от 0 до 1.

#shader #smoothstep