I see a lot of great tutorials that make a big mistake. They advocate making lots of public fields/variables in Unity scripts. Even some of the best tutorials do this, and it’s BAD! It’s no surprise then, that many beginners make all of their variables public. Public fields have their place (or they wouldn’t be … Read moreTMI! Stop Making Everything Public!
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
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
Unity has events that tell your scripts when the mouse cursor hovers over an object and stops hovering over an object. This can be great for UI or for prompting the player that they they can interact with something. Note: this is an older post that uses the old Unity input system. This will still … Read moreInput: Detect Mouseover
Many games show dialogue with a popup speech bubble, or prompt you to press an action button when you approach an object. In this tutorial I’ll show you how to create a popup UI object that can be used for any kind of popup need in your Unity game, using Unity’s flexible UI system. Here’s … Read moreSpeech Bubbles and Popup UI