Design a site like this with
Get started

Day 48: New Behaviour Script

If you want to change the default new script when you Create -> C# Script in Unity, follow the path ~\Unity\Editor\Data\Resources\ScriptTemplates and edit the text file named 81-C# Script-NewBehaviourScript.cs.txt

Sorry, I don’t know what the path is on Mac

Note: You may need to run Notepad as an administrator if you get the ‘Access is Denied’ error message.

With the text file open, you can now edit the default new script.

I deleted the comment lines because they were unnecessary and felt too cluttered. As I get more experienced and see what functions I use frequently in a project, I can tweak it further and save some time.

Current Progress Status

  • Tower Defense Tutorial: 47/73 -> Health Bar Tutorial: Completed
  • Unity in Action (Pg 336 of 352)



Day 45: Time.deltaTime

I grew up playing on dedicated consoles like the Sega Genesis where a game would run exactly the same no matter whose Sega you played it on.

On PC, developing a game means having to adapt code to run smoothly on virtually an unlimited amount of computer configurations.

This is where the concept of Time.deltaTime comes in. (I’m just reiterating what I’ve learned to solidify the points in my head – feel free to correct me if my understanding on any of the points are wrong)

Let’s say I’m creating a game where I want to move an object at the speed of 6:

public class moveObject : MonoBehaviour
     public float speed = 6f;
     void Update()
         transform.Translate (speed, 0, 0)

But I’m poor and have a slow computer. It runs the game at 30 frames per second.

FPS (30) * speed (6) = 180 (distance moved)

Someone else has a faster computer. It plays at 55 frames per second.

FPS (55) * speed (6) = 330 (distance moved)

In one second, the game object on the faster computer traveled nearly twice as far in the same time because it called the Update() function 25 more times in one second.

Time.deltaTime is used make this movement frame independent. It represents the time passed in seconds since the last Update().

public class moveObject : MonoBehaviour
     public float speed = 6f;
     void Update()
         transform.Translate (speed * Time.deltaTime, 0, 0)

My Slow Computer
30 (frames) / 1 (second) = 0.0333333333333333 (time between updates)
Speed * Time.deltaTime =
6 * 0.0333333333333333 = 0.2 (amount moved each frame)
30 FPS * 0.2 = 6 (distance moved each second)

Someone’s Faster Computer
55 (frames) / 1 (second) = 0.0181818181818182
Speed * Time.deltaTime =
6 * 0.0181818181818182 = 0.109090909909091
55 FPS * 0.090909099090909 = 6 (distance moved each second)

Using Time.deltaTime made the distance traveled by the object frame independent. Now no matter how fast or slow your computer runs, it will move at the same rate on screen as another player’s.

The same principle applies on the same computer. If I have a lot of programs running, my game might be running slower at some points and faster at others. Time.deltaTime will smooth the movement of the object instead of it looking twitchy each time Update() is called and the object ‘rushes’ to catch up.

In the same vein of frame rate independency, I also need to learn about FixedUpdate() for physics calculations.

Current Progress Status

  • Tower Defense Tutorial: 47/73
  • Unity in Action (Pg 324 of 352)


Day 41: Script Reference

I was only able to complete a short tutorial lesson today, but I did spend a fair amount of time browsing through Unity’s scripting reference. It’s a thorough reference to Unity’s entire API with every command listed.

There’s obviously way too much to remember but I like getting a general overview of what functionality is available.

Current Progress Status

  • Tower Defense Tutorial: 40/73
  • Unity in Action (Pg 229 of 352)


Day 38: Editing Multiple Prefabs

I was never able to select multiple prefabs in Unity’s Project window and edit them in the Inspector like I was seeing done in tutorials.

Unity apparently overhauled their prefab workflow in 2018.3(?) which no longer allows users to do so. (I’m on 2018.3.6f1)

There are two ways to go about getting this functionality back.

Workaround method: Drag the Prefabs into the Hierarchy window. Select them and edit the properties you wish to apply to all of them. Then in the Inspector window, click on ‘Overrides’ and then ‘Apply all.’ The changes have now been effected to all of the Prefabs and you can delete them from the Hierarchy.

A bit of a hassle, but it works.

Install preview build: Unity heard the grumblings and developed a preview build that allows multiple prefab editing from the Project window. Read more here. (I like how Unity listens & responds to their base and makes adjustments when feasible)

Until that particular build passes their Alpha/Beta testing, I’ll continue using the stable version with the workaround.

Current Progress Status

  • Tower Defense Tutorial: 37/73
  • Unity in Action (Pg 207 of 352)


Day 37: Animator Override Controllers

Youtube comments are generally toxic garbage but sometimes there are exceptions, especially when it comes to tutorials. I’ve found it useful to read through the comments before watching the video to see if anyone has posted any helpful tips or encountered problems.

In video #35 of the Tower Defense tutorial, we’re shown how to animate the enemy characters. After demonstrating how to set up the first monster, we’re directed to repeat the tedious and time consuming process for the remaining three. (It took ~30 minutes just for the first one and it only has an up, down, left and right animation.)

Enter Youtube user “Draven” who informs us of Unity’s Animator Override Controllers which allows us to copy the transitions and animations used from the first monster and apply them to the remainder. (It took less than a minute to create each controller.) It’s a time saving tip that will be very useful in projects going forward!

Animator Override Controllers

Current Progress Status

  • Tower Defense Tutorial: 35/73
  • Unity in Action (Pg 183 of 352)


Day 33: Deploying to iOS

One of the major draws of Unity is the ability to deploy your game to over 20 different platforms – more than any other creation engine.

What I didn’t know when it comes to publishing an iOS game with Unity is that I’ll need a Mac – or at least access to one in order to compile the Xcode & submit to the app store.

One alternative is to install a macOS virtual machine, but my old computer can barely handle Unity alone as it is.

A second option may be to use a cloud-based Mac solution.

Another workaround could be iOS Project Builder for Windows that’s available in the Asset Store. Some of the reviews state that setting it up could be a pain and because Apple recently forced all developer accounts to switch to two-factor authentication, not everything works properly.

Finally, the last option is to find the cheapest possible Mac I can.

Current Progress Status

  • Tower Defense Tutorial: 30/73
  • Unity in Action (Pg 122 of 352)


Day 29: A* Algorithm

Pathfinding is an important element in many games including the Tower Defense genre. In order for enemy AI reach their goal, they need to traverse around obstacles the player places in their way. (Note: some Tower Defense games use predetermined paths instead)

That’s where the A* algorithm comes into play. I’ve enjoyed learning about it and am at the point where it’s being implemented in the game tutorial.

Sebastian Lague has a great Youtube series on A* and Unity. His first video helped to crystallize in my mind how the algorithm worked.

Tower Defense Tutorial Progress: 20/73


Day 23: Language Immersion

I spent a summer in Germany one year and wound up watching a lot of TV during my stay. The subtitles were always on: German show, English subtitles and vice versa. Because German uses the Latin alphabet too, it was easy to follow along.

By the end of a few weeks I had begun to recognize and pick up common phrases like greetings, pronouns, and the like.

That’s the stage I’m at in my learning C#. It’s looking less like a completely foreign language. I’m recognizing keywords, modifiers and parameters. I know I’m making progress even if I don’t understand everything 100%.

Isometric Gaming

Unity just added a blogpost & video tutorial regarding the Isometric Tilemap support which was added in 2018.3. This type of visual perspective appeals a lot to me since many of my favorite games utilized this view.

The new Tilemap features provide a fast and performant way to create 2D environments based on isometric and hexagonal grid layouts, the likes of which are seen in many game classics, including the first entries of the Diablo and Fallout franchises, Civilization, Age of Empires, and many more.

25GB+ of Sound Effects (Free)

Sonniss GameAudioGDC Bundle

​In celebration of GDC 2019 we are giving away 25GB+ of high-quality sound effects from our catalogue. Everything is royalty-free and commercially usable. No attribution is required and you can use them on an unlimited number of projects for the rest of your lifetime.

This reddit post also contains links to previous year releases

Tower Defense Tutorial

Progress: 2/73 videos

This will take a lot longer than I first outlined in my weekly goal. At 20 hours of video, which means more like ~40 hours including implementation, it will take about a month if I work on it ~1 hour a day.

No more dillydallying then.


Day 20: ProBuilder

The final lecture of CS50G course introduced me to new concepts such as Raycasting, Render Texture & Texture Masking. I was also excited to learn about a free Unity tool called ProBuilder which allows you to quickly prototype 3D environments.

Windows -> All packages -> ProBuilder -> Install
(Then ProBuilder will show up under 'Tools')

Next up, I’m planning on following along tutorials from:

I’ll pick and choose game types that I find interesting and just jump in.

If you have any other favorite Youtubers with tutorials about creating Unity games from scratch, please share in the comments.


Day 15: Casual Endless Flyer

The game dev lectures at HarvardX: CS50G, while informative, are not like the how-to tutorials you’d see on Youtube.

There isn’t a step-by-step creation process to follow. Instead, the game is already completed (everything including models, sounds, and scripts) and then after watching the lecture your assignment is to make certain tweaks or additions to the game.

The lecture for the 3D Helicopter game is ~2 hours and the instructor does talk in depth about the game, but I don’t feel this would be a good place to start if it was someone’s first foray into Unity.

I spent several hours going through the code and editor, trying to figure out and understand what was done and where.

My version of the helicopter game I have linked in the video below is basically what would be termed a ‘reskin.’

I created a new scrolling background in MS Paint (because I can’t draw anyways), new sound effects using Bfxr, new explosion effects dabbling with particle systems, added music from Bensound and changed the font, layout and model colors – but the core of the game – the 3D models and code are not mine.

Still, it was altogether a good learning exercise. I basically have the framework to complete a simple endless flyer from scratch but need to learn how to build 3D models in Blender, animate and import them. The game itself isn’t technically 3D…more like 2.5 since it’s 2D with 3D elements.

Royalty Free Music from Bensound
Airplane, helicopter & building model by HarvardX: CS50G
Coin font from Lecompte Free Font (Andy Lobjois)
Spinning Coin model from Proto Pack (PIXELATTO)

The assignment for this game is two parts:

  1. Introduce gems into the game that spawn just like coins but more rarely; each gem should be worth 5 coins
  2. There’s currently a bug where the scroll speed of skyscrapers and coins doesn’t reset on game over (hint: static variables don’t refresh on scene reload); find and fix this!

I’ll start working on this tomorrow.


%d bloggers like this: