Unity: Callbacks and Multi-Threading

Even if you’re not explicitly working with multi-threading, Unity’s internal processes might be, and it’s crucial to be able to recognise a threading problem when you encounter it. Unity can execute your code on other threads and this might cause multi-threading-related issues in your code.   Unity employs multi-threading in the serialization, build process and … Read more

Unity: Load Assets in Editor

Sometimes you need to load assets in the editor without the comfort of a direct reference. Assets are loaded using the AssetDatabase and it can be done by Instance ID The instance ID is visible at the top of the inspector when the inspector debug mode is active.   Beware, the instance ID  survives enter/exit … Read more

Programming Glossary

Have you ever wondered what makes code “dirty,” what refactoring entails, and why there are no silver bullets in programming? I’ve compiled a glossary with brief explanations to help you gain an overview of some of the perplexing phrases often used by programmers. If something is missing that you’d like to see explained in the … Read more

Unity: Better Inspector

Improving the inspector in Unity can have significant benefits for game development efficiency and workflow.   An organized and easy-to-read inspector layout can provide quick access to game objects, components, and properties, making it simpler to identify and modify different elements of the game without having to navigate a cluttered and confusing interface.   In … Read more

Unity: Events vs Interfaces

“Events are evil!” is a common opinion among Unity developers. What are the reasons behind this statement and are interfaces an alternative to events? Example implementation at the bottom.     Problems A common source for event bugs are timing issues. For an event to work correctly you have to subscribe before it’s triggered and … Read more

Unity: Create Assets with Dynamic Name/Properties

Problem The CreateAssetMenu attribute is handy if you want a quick way to instantiate scriptable objects.  But it falls short when a dynamic name or the initialization of different properties is needed, for example, the generation of a custom ID.   Solution The solution is to create the asset yourself. The CreateAssetMenu attribute is only … Read more

Unity: Comment Component

Problem Do you ever think “The GameObject setup is so weird, it should be documented” but then don’t do it? Or are you forced to insert components in strange places because Unity just can’t do it any other way? Keyword: Unity’s UI rendering order is influenced by the hierarchy.   Most of the time it … Read more

Unity: Screen Space Gizmos

Unity’s default gizmos are essential for visual debugging but can only be drawn in world space. This restriction can be rather annoying if you try to debug custom UI or viewport-based camera movement. A simple line at a specific pixel coordinate would solve the problem most of the time. There are two solutions to this … Read more

Unity: UI Workflow Improvement

  If you build a game in Unity you will need a few UI screens to guide your player. The number of canvases will increase with the complexity and size of your project.   The canvases and the UI graphics will start to clutter your scene view because canvases are not moveable. This leads to … Read more