Toddler Tower Defense


Toddler Tower Defense is a Unity tower defense game created by me in two weeks using assets from the Unity Asset store and custom C# scripts. My goal with this project was to primarily learn more about scripting while creating a fun tower defense game.


  • Created in two weeks
  • Created using Unity Asset Store assets
  • Custom scripts
  • Custom sound effects

Taking Baby Steps

After having played around with visual scripting in Unreal Engine during the summer break of 2015, I really wanted to learn more about scripting. Ever since I played Warcraft 3 as a kid I have wanted to create a tower defense game with custom scripts and graphics. I thought Unity would be a great tool for me to build my very own tower defense game.

I started out by opening Unity and writing various basic scripts in order to learn how to use C#. At first, I just copied and combined various scripts that I found using the Unity Scripting API without really knowing how the individual scripts worked.

This approach to scripting suprisingly got me pretty far, with things like spawning enemies and laser beams dealing damage working just fine.

My first tower defense prototype in Unity

Learning by Failing

After a while though, things started to break and, since I didn’t know why things worked, I couldn’t figure out why they didn't work either. Therefore I decided to go through all of the code I had written step-by-step and, in my own words, explain what each row of code did using comments.

Once I was done explaining everything to myself, working with C# and Unity started getting a lot easier. Now that I had learned the basics, I could play around and experiment more easily. The iteration time for prototyping new features became shorter and made tweaking and polishing more efficient.

Explaining each row of code in my own words

Adding Advanced Functionality

A few days later, I had a fully functioning tower defense prototype with enemy cubes, two kinds of towers and the ability to sell and purchase new towers using the UI function built into Unity. After that, I wanted to take my project to the next level by adding more functionality to it.

I started out by creating a grid of quads near the ground that would serve as turret bases. When the player hovers his or her mouse over the quads, after having clicked a turret button, the texture changes to indicate that the player can place a turret on that quad if he or she wants to.

What the quads look like in Unity

What the quads look like in game

Adding More Functionality

Once the turret has been placed on the quad, the player can see the range by hovering over the tower. The range and attack speed of the turret could be upgraded by pressing the upgrade button and clicking on the turret. I also added health bars to the enemies by creating a seperate UI as a child to each enemy game object and making it face the camera using a script.

After that, I created an infinite enemy spawn loop which made the game more survival oriented while adding replayability to my tower defense concept. After each wave, the enemy health and speed was multiplied. Each enemy gave the player score points when they died and the player could see his or her score at the bottom of the screen.

The player can see how far his or her turrets can shoot

Time to incorporate some assets

Making it Pretty

Finally, in order for me to test my scripts as well as improve the look of the game, I decided to incorporate assets from the Unity Asset Store into my level and apply my scripts to those assets. The Survival Shooter package from Unity suited my needs perfectly with a semi-modular environment, cool sound effects and beautiful graphics.

As a fun add-on, I also created a main menu where I placed a new camera in the scene and spawned enemies without health bars continuously in front of the camera.

I then also added sounds and music to the level. I used “In the Hall of the Mountain King” as the main theme and later created a looping version of that song using Audacity.

Looking good!

Closing Thoughts

Given more time, I would have replaced my turrets with some better looking props, and I would have also added more varied enemies and towers. Implementing assets that were intended to be used differently was challenging and time consuming. A lot of focus was dedicated to the graphics rather than the features, which meant the final product lacked some versatility. My main goal however was to learn how to use C# and that is something I definitely had use of during my time at The Game Assembly. All in all, I loved working with C# as my first scripting language and I felt I learned a lot from the experience.