Menu

Scripting

Simple Script for Gamepad UI Navigation
For my upcoming game, Mouse Dreams, I need to support gamepad input as well as keyboard and touch. It turns out this is not quite as simple as I first [...]
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 [...]
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 [...]
Input: Detect Mouseover
  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 [...]
Stop Looking, You Already Found It!
Wherever Unity is discussed I see a mistake repeated by new Unity developers. It’s not a dumb or obvious mistake, but it can be a costly one. [...]
Drag-and-Drop
Drag-and-drop functionality is useful for many types of games – an inventory system in an RPG, dragging letters onto a word game board, etc. With a [...]
A Navigation Helper for Unity
Unity lacks a way to pass parameters to a new scene. If you want to send some game state data to the next level you have several options, such [...]
Giving Enemies the Power of Sight!
Enemies are more challenging when they have some intelligence. A great start to building enemy AI is to grant enemies the power of sight! Sight is really a [...]
Using the Debug Class
Unity has a Debug class with some really useful functions for speeding up development, testing, and debugging. You probably already use Debug.Log() to add [...]
Change a Sprite’s Transparency
Adjusting a sprite’s transparency can add dynamic ‘juice’ to your game. You can make items flash on and off, make translucent ghost, or [...]
Unity Scripting Primer Part 3: Collisions and Triggers
Following on from Part 2, where we looked at the common Unity MonoBehaviour methods like Update() and OnEnable(), in Part 3 we will look at the [...]
Unity Scripting Primer Part 2: MonoBehaviour Basics
In Part 1 I covered public and serialized variables in Unity scripts. In Part 2 I will talk about MonoBehaviour methods. Unity scripts by default inherit [...]
Unity Scripting Primer Part 1: Public and Serialized Variables
We’ve all asked for help online and been given a succinct answer that, while probably 100% accurate, wasn’t any help at all because the helper [...]