Everyday Unity – Telegram
Everyday Unity
1.11K 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
How to unit test a class that uses static API

Unit tests validate code in isolation, but if it uses statics you cannot mock this dependency, therefore a subject under test cannot be properly isolated and unit tested. This trick makes the code testable, as well as introduces an important principle that improves your architecture by making it cleaner and more flexible.

https://gamedev.center/how-to-unit-test-a-class-that-uses-static-api/

#testing #cleancode #architecture #testrunner
👍1
4 tips for refactoring your code for readability

As I work in a big team on a game-service I cannot emphasize more how these principles are extremely important:
- Consistency
- Conventions
- Intent
- Brevity
Well, even if you work alone it still applies, since most likely you will read it many times in the future. These principles will save you a bunch of time later.

https://youtu.be/7oZBfpI_hxI

#cleancode #readability #refactoring
Const Strings – a very convenient way to shoot yourself in the foot

Const can be dangerous if you have your code base split into DLLs and one references consts of another

https://www.stum.de/2009/01/14/const-strings-a-very-convenient-way-to-shoot-yourself-in-the-foot

#const #readonly #dll
Branching on a GPU

- Do not fear branching on a GPU, in many cases it’s completely fine
- Know what you are branching on, and what you are branching around.
- Avoid branching on high frequency data and creating divergent pixels
- Branching around textures requires special care
- Visualize the data so you can see exactly what the GPU is doing
- Order your branches from most likely to cull to least likely if possible.

https://medium.com/@jasonbooth_86226/branching-on-a-gpu-18bfc83694f2

#gpu #shader #branching
Editor Iteration Profiler (EIP)

Monitor and capture profiling data from assembly reload, assembly compilation, and enter playmode.

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

#editorprofiler #profiler #editortool
My approach to optimization

Advice about optimization with very interesting points like "Do I really need this state or can I just compute it every frame instead (Computation is fast, memory is slow)?" about which we do not always think in the day to day work

https://medium.com/@jasonbooth_86226/my-approach-to-optimization-bfcafc1f8768

#optimization #tips
Test Driven Indie Game Development

The author doesn't quite use TDD, but the point is still clear: automated tests increase initial development time, but save a lot more time to support code. Given that there are so many game-services now, support becomes 10 times more significant.

https://dbzer0.itch.io/hypnagonia/devlog/335569/test-driven-indie-game-development

#testing #automation #unittest
👍1
Drawing with SDFs in Unity

A simple drawer example with SDF shader

https://bronsonzgeb.com/index.php/2022/01/15/drawing-with-sdfs-in-unity/

#sdf
👍1
Best optimization tips by Unity engineers at Unite

Compilation of best Unity tips gathered at Unite conference. I spent a bunch of time rewatching those talks so you don’t have to.

https://gamedev.center/best-optimization-tips-by-unity-engineers-at-unite/

#unite #tips
👍3
Abusing For Loops In C# For Job Security

Found at r/shittyprogramming, indeed "helps" to become an irreplaceable developer. Still a fun read tho.

https://eddieabbondanz.io/post/c-sharp/abusing-for-loops-for-job-security/
👍1
Like Regular LINQ, but Faster and Without Allocations: Is It Possible?

Article got insights on how LINQ works. As a practical advice I don't find it really useful, because I am pretty sure you are not using LINQ in a hot path. And you gotta be a die-hard fan of it to carry an additional dependency just to use LINQ in critical sections

https://blog.devgenius.io/like-regular-linq-but-faster-and-without-allocations-is-it-possible-3d4724632e2a

#linq #enumerator #reflinq
👍1
When to make LODs

Look in the wireframe view, when it starts to get close to solid, you need to swap to a lower LOD, which significantly reduces the density of the wireframe view.
In many cases, you’re better off with a single LOD and an imposter for the distance, or in some cases no LODs and just an imposter.

https://medium.com/@jasonbooth_86226/when-to-make-lods-c3109c35b802

#rendering #lod
👍1