Game Design – Unity


This set of activities will cover how to complete some key tasks in Unity.

Each activity / lesson should be a standalone task and will cover how to carry out a task.

They are designed to be carried out independently and the concepts used integrated into a larger project.

The activities can be carried out in any order.

Articles

  • Firing a Projectile (with Physics)

    This lesson covers how to spawn a projectile when the user presses the default fire button (left mouse click) using the Input System. You should know how to / already have: First Person player controller Input Actions with a Fire action binding already setup. A level to test the scripts and code on. You can…

  • Laser Tower that automatically attacks targets within range using (draw line in game)

    This guide will demonstrate how to make a tower that will shoot a simulated laser at a specified time to the first object that moves within it’s range. You need to be able to: move a character around on the scene Have a Player Properties script attached to the player with a public health variable

  • Adding a Canvas and UI to a scene

    You can have multiple Canvas’ on a scene. Open a scene. Go to GameObject > UI > Canvas This adds the Canvas and the EventSystem objects Select EventSystem In the Standalone Input Module component click the button Replace with InputSystemUIInputModule. This enables the UI to work with the Input System Often you want the Canvas…

  • Environmental Damage: Taking Damage from an Area

    This guide shows how to create an environmental obstacle. In this case a section of the map set to be lava that will inflict damage over time while the player stays in the area. The code has been written so that it can be dropped onto enemy or other objects and have the same effect…

  • Enemy AI: Infinite Spawn Point / Tower

    This lesson assumes that you have completed the guide on how to get an enemy object to chase the player using the nav mesh agent. You can find the lesson here. There is an example of an infinite enemy spawn tower which can be downloaded here. This will set an object that will infinitely spawn…

  • Enemy AI: Chase a player

    This example will have an enemy player chase a player object. An example of an enemy chasing a player (with a spawn point created) can be found here. It assumes that you already have a player prefab and an enemy prefab created. Setup your level / environment with the enemy object (with no scripts) Add…

  • UI Buttons to Spawn and Despawn Objects (Grid Layout)

    Download the example here. This example builds on from the spawn and despawn prefabs in the scene tutorial. This tutorial will add a set of UI buttons that will allow you to select a prefab to spawn. The grid layout component is used to align the buttons. Create the prefabs you want to use for…

  • Spawn and Despawn Objects when you Mouse Click in a Scene

    There is an example of this here. Setup a scene with varied terrain on it. Create prefabs that can be used to spawn objects. You only need one for this example. Set the parent of the prefab to have a tag named Player (or whatever you wish). We will use this later to check if…

  • Custom Cursors for a Pan and Scroll Camera using Cinemachine

    You can access a windows example here. You need to have completed the lesson on creating a Pan and Zoom camera before attempting this one and expecting it to work fully. You can use this to learn how to change cursors though. The code below is what is used to change the cursor. It takes…

  • RTS Style Pan and Zoom Camera using Cinemachine

    This lesson will have you create a camera that can pan and zoom using a Cinemachine Virtual Camera and the Input System. This is similar to RTS Style Cameras in Command and Conquer, Star Craft, and League of Legends. You can download an example build of this here. Create a scene and add the terrain…

  • Creating a Camera path using Cinemachine Track and Dolly

    This lesson will use Cinemachine and the Track and Dolly virtual camera to create a path for a camera to follow. A dolly track is a path for a camera to follow. We will create an animation for the camera to follow. First load a scene with an environment you with to have the camera…

  • Twin Stick Movement (Left Move, Right Look Direction)

    Here we will use the input system to move a player in a twin stick format. This will include Controller and Keyboard and Mouse controls. For a controller the left stick will control movement and the right stick will control the direction the player is looking. For Keyboard and Mouse the Keyboard will control movement…

  • Creating Custom Player Inputs

    Create a new set of InputActions. I’ve called these TwinStickControls Open the InputActions Create a Control Scheme. Click No Control Schemes and then Add Control Scheme. Add Keyboard and Gamepad. Add an Action Map for the Player. Also check Auto Save Asset First we will get our player moving. Add an Action using the +…

  • Creating a Loading Bar

    In this lesson you will create a loading bar to use when loading different scenes. We do this so that we can load content in the background of the game while we are carrying out other tasks. Think of examples where you are forced to walk through a small gap. This is used to mask…

  • Play audio with a subtitle

    You need to be able to create a trigger that plays audio when entering a collider as well as have a basic understanding of UI canvases in order to complete this lesson. Setup a Unity Scene with a player object and a trigger that plays a sound when you enter it. You can find a…