Asynchronous Operations (theory)

I’ve been quite interested in asynchronous operations and Unity recently. From my understanding, we typically call these when there’s an operation to be completed, such as a web request or a download, that isn’t going to be completed instantaneously. If we execute something synchronously, we’re waiting for the operation to finish before moving on to another task, whereas executing something asynchronously allows us to move on to another task before it finishes (i.e. it doesn’t bring the program to a complete halt).

I’m drawing very heavily from a Stack Overflow answer with this one (as a lot…

This is just an article on something I’ve found useful time and time again when creating game systems. While I won’t pretend to understand everything there is to know about structs, I hope I can provide an overview on what they are and why you should consider using them (if you aren’t already).

There might have come a point in your programming when you need to package up and store multiple variables together, something which, say, a list of one of the standard variable types is unable to provide. For example, let’s say we want to keep track of what…

Appreciate this topic’s a bit late but it is fairly close to my heart 😉 Loved getting to learn about and use these

I think there often comes a point for a budding Unity developer when we want to, say, specify something in the inspector to give an object a custom type of sorts. When starting out, we might leave a serialised private string field or we might leave a public string field for us to enter the type in the inspector. For instance, lets say in our game there are four ‘Items’ we can buy at the store, and these can be: ‘Mocha’, ‘Latte’, ‘Cappuccino’, and ‘Croissant’. …

The majority of the changes needed for this attack animation were in Unity rather than in any script, but I’ll start with the main code adjustment 😉


From Update in the Player class, I’m now calling a “Player_Attack” method. This just checks to see whether the left mouse button has been pressed and that the player’s currently grounded, and if these are both true then it calls the public “Attack” method on the PlayerAnimation class we looked at previously. I’ll include these snippets below:

The Player’s coming to life a bit more in this 2D mobile adventure game project 😉 This is mainly thanks to setting up the AnimatorController, the animations, and this ‘PlayerAnimation’ script (which handles and stores the bulk of the code needed to control the Animator component, as well as adjust the sprite according to which direction the player’s moving).


Unity makes setting up 2D animations pretty easy as long as we have the right assets. Once you’ve split your sprite sheet into multiple sprites (take a look at the ‘Adding Sprites’ section here if you’d like a quick refresher), we…

I recently started work on this Player script for the 2D mobile adventure game project, and prioritised getting the movement and jumping logic down first. Rather than use Unity’s CharacterController component as we’ve done previously specifically the CharacterController.Move() method and CharacterController.isGrounded boolean), I’m working instead with just a BoxCollider2D and RigidBody2D components.

In particular, I’m taking the player’s horizontal input (multiplied by a speed variable) and changing the RigidBody’s velocity accordingly in order to give the player some movement. The RigidBody’s taking care of gravity, so those variables are on the component rather than in the script this time.


Following on from the previous article on Animated Tiles, another nifty little thing we can work with using Unity’s 2D Extras are these Prefab Brushes. As the name suggests, they allow us to ‘paint’ our own prefabs onto tilemaps within our scenes. This can particularly come in handy when you need to, say, dot some coins or other collectibles around your scene (and which might well have custom scripts and behaviours).

If you’ve imported the 2D Extras assets, you should be able to right click in your Project view and navigate to Create > Brushes > Prefab Brush.

I recently learnt about how we can create animated tilesets in Unity using some of the files included in Unity’s “2D Extras” repository. I believe the repository’s been discontinued, but you can still access it (as well as versions of it for previous Unity versions) here. I’d personally recommend selecting the “2018.3” branch, as that has a fairly quick and easy to use Assets folder (that we can just download as a zip, unpack, then merge into the Assets folder of our Unity project).

Once you’ve imported this, you should be able to right click in your Project view and…

I recently began work on a 2D mobile game project for the GameDevHQ course, and started out by working with Unity’s 2D Tilemap Editor. I believe this comes as a default package in Unity, but if not you may need to add the package via the Package Manager to get started 😉

Essentially, Tilemap offers us a quick and uniform way of creating 2D environments by letting us ‘paint’ tiles onto a grid in Unity. This often lends itself well to creating more retro-looking games (e.g. …

I recently implemented this reload animation to the First Person Shooter project I’ve been working on for the GameDevHQ course. Essentially, this consists of an Animation (made in unity), an Animator Controller, and a script adjustment so that the ‘R’ key triggers the animation.


With an object with an Animator component selected (in my case, the gun itself), we can head into the Animation window and click to ‘Create [a] New Clip’. …

Marcus Ansley

Game Developer | Game Design and Literature Graduate

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store