Fix Null Reference Exceptions

In C#, one error puts fear, confusion, and frustration into the heart of every developer, especially beginners: NullReferenceException. It will look like this in your Unity console, and it will cause your game to not work. In case that screenshot isn’t clear, it reads: NullReferenceException. Object reference not set to an instance of an object … Read moreFix Null Reference Exceptions

Raycasting Part 1: Everybody Loves Raycasting

Raycasting is one of those topics that everyone seems to struggle with at first, so here is a tutorial covering everything you need to know about raycasting in Unity. In this post I’ll explain what a raycast is, how to use a simple raycast, and point out a few potential problems and pitfalls people run … Read moreRaycasting Part 1: Everybody Loves Raycasting

Save Time and Hassle with RequireComponent

You can use RequireComponent in your Unity scripts to save yourself some work and avoid errors. When your script requires a component, Unity will add a component of that type to your GameObject automatically when you add your script (if a component of the required type is not already there). You also cannot remove this … Read moreSave Time and Hassle with RequireComponent