Unity3D Meta-Tutorial for Survival Shooter

Unity3D Meta-Tutorial for Survival Shooter

On the main page for this tutorial I learned that this tutorial was the end result of a public speech at a conference.  Every year there is a conference called ‘Unite’ where ‘Uni-tics’ (thats a portmanteau of unity and lunatics) (of which I am one)  get together to talk and learn about Unity3D and in 2014 this tutorial was one of the talks at that conference.  You can get the slides that they presented at the time from the main page (linked above) and here is a youtube playlist with all 10 of the videos.

Pro Tip: As you are watching the videos, if you want to watch them faster, youtube (desktop) lets you speed up the videos and since its so easy to pause them you can speed through most of the stuff, then pause and implement what they say to do, and then unpause and proceed with the rest of the tutorial.

Pro Tip 2: If you want to go really fast then turn on the closed captioning so you don’t even have to try to keep up with their high speed spoken words.

Further Resources:

If you get stuck along the way please contact me.  I would like to help.  If you want to dig into it on your own then consider looking at the following:

  1. the support forum thread for this tutorial
  2. the “upgrade guide” that is in the assets folder of the project created (once you’ve downloaded the project files) (its called “Tutorials-SurvivalShooter-Upgrade to 5.pdf” and you can’t see it from Unity so you”ll have to navigate to it through the file system)
  3. the comments on the youtube videos (I’ve discovered that these can be quite helpful sometimes!)

Also it’s worth noting that all of these videos have youtube live transcripts so you can read what they are saying (roughly) and click on a line to jump right to that spot in the video.  This lets you skip ahead or back up in the video easily.

What is this ‘Survival Shooter’ that this tutorial speaks of?

Sometimes a picture tells a thousand words.

Sometimes a moving picture beats a thousand pictures.


Survival Shooter
Survival Shooter


Environment Setup

Video Duration: 10m11s

This tutorial as a whole has a lot of spit and polish to it.  Its targeted at complete beginners and as such it starts off helping you get Unity3D setup the same way they have it so things are more likely to look and work the same.  A substantial caveat is that these videos were posted in October 2014 so I predict that there will be some level of tut-rot but never fear my dear reader because thats what this meta-tutorial is for!

Where is my project data

The tutorial videos gloss over this completely (wtf!?!) so I’ve made a simple video to show you how to do it.

The project data is downloadable from the link on the main page of the tutorial

Link to Project Data
Link to Project Data

Delete the Directional Light

In the Upgrade Guide it says that you need to delete the directional light from the Hierarchy pane.  That light comes as a default light in Unity 5 and didn’t in unity 4.6 and the lights that they have you import are perfectly suited to this game so the directional light just disturbs the lighting balance that they had developed.

Tip – Convert project panel to list view.

A good tip I just learned is that it is easy to convert the project panel to list view simply by dragging the slider down to 0.

Project Panel to List VIew
Project Panel to List View

Missing Folder

In the video and the narration they speak as if there is already a folder in assets called ‘scenes’.  Well in the project I downloaded there is certainly not a folder called scenes. The narration seems to imply that you shouldn’t put it in the assets folder directly but in a subfolder so make a scenes folder in assets if its not already there.

Background Music

I don’t know if the bgm is supposed to play when I hit ‘go’ but it didn’t until I checked ‘play on awake’ (which they talk about in the video).  I’m going to uncheck that now to match the settings in the video.

Directional Light

In the Upgrade Guide

Implementations learned in this section

  • Adding background music
  • Converting project panel to list view
  • Object Layers (just a touch)

Adding the Player Character

Video Duration: 35m51s

Adding an Animation Controller

Just prior to actually adding the Animator one of the speakers talks a bit about .fbx files and how the animations are stored within the model.  He also speaks of ‘retargeting’ a process in which you apply an existing animation to another skeletal model but in order to do this the model must have been through a process called ‘rigging’.  I don’t believe we will be doing that in this tutorial (since this player model is much simpler and rigged ‘generically’) but this is how many models are animated after they’ve been created and I’m glad he mentions it here.

He explains that the Animation Controller is a state machine that controls when each of the animations that already exist in the player model are going to be played back.

Once again the folder that they say is there is not so you will need to create a new ‘Animation’ folder in the project pane.

There is a Discrepancy in the settings

I just noticed something possibly slightly disturbing:

Different default settings
Different default settings

Both ‘Culling Mode’ and ‘Apply Root Motion’ are different!  Lets see if there is anything about this in the ‘upgrade’ document in the root folder of the project… Aha!  yes it does address ‘Apply Root Motion’ and states that it won’t matter.  For the purposes of this tutorial I am going to assume that they also believe the difference in culling mode won’t matter and I will proceed with the tutorial.

Adding Animation Parameters

The upgrade guide mentions that the parameters are no longer in the bottom left but in a tab in the top left.

At 9m53s he explains that a trigger is like a boolean but it resets itself back to false as soon as it has been consumed so it can be used to trigger things to happen once.

Important Note: For every transition in this tutorial you must uncheck ‘Has Exit Time’ (found that note in the upgrade guide AND in the youtube comments).

Physics Rigidbody

Setting drag and angular drag to infinity is an interesting approach that I haven’t seen before.  This means the player will stop instantly instead of floating along at all in the direction they were moving.

Implementations learned in this section

  • Adding an animation controller
  • Viewing built in animations in a model
  • Importing animations into the Animator
  • Finding animations within an FBX file in the project pane
  • Adding animation parameters
  • Transitioning between Animation states
  • Adding a rigid body for physics

Coding the Player Character

(same video ~19m10s)

This section speaks about some new things:

  • FloorMasks LayerMasks and RayLengths
  • FixedUpdate vs Normal Update
  • Normalized Movement
  • Time.DeltaTime
  • Raycasting

This seems to be an advanced and mature way of controlling the character and I am probably going to use this in other games.

Wow! By the time this video is done movement works and its pretty darned cool seeing the player character bumble and jump and twist like that!

Implementations learned in this section

  • A great way to control a player based on raw inputs
  • Normalized movement
  • Rotation based on the ray cast between the player and the mouse

Camera Setup

Video Duration: 9m15s

Topics and Implementations touched upon in this section

  • Orthographic Cameras
  • Camera following the player
  • Smoothing (so the camera movement isn’t quite so abrupt)
  • Vector3.Lerp to help with smoothing
  • Time.deltaTime to make your game frame rate independent

The Scripts/Camera folder doesn’t exist so you’ll need to create it.

Note: You must set ‘clear flags’ while you are here to ‘solid color’ (see the upgrade guide for a bit more info)

Time.deltaTime to me doesn’t makes sense (it obviously works I just don’t know what it really means).  I’m going to look it up with CMD or CTRL + ‘ … ok I learned that it is the time since the last frame (context sensitive to Update or FixedUpdate) so this would be some number of … microseconds (I presume)? Ok this screenshot from the documentation helps a bit:

Unity3D Time.deltaTime Documentation
Unity3D Time.deltaTime Documentation

Adding the First Enemy

Video Duration: 23m46s


I found the difference between a normal collider and a trigger collider interesting in that the trigger collider doesn’t take place in any physics interactions.  Instead a function is called behind the scenes whenever it collides with the player.


The Nav Mesh Agent section made me wonder what would happen if I didn’t change any of those values … I might try that later (after this all works).

The layout of these navigation panes both  looks slightly different from the video.

Note: The Upgrade guide says that you must set Step Height to 0.34 and Manual Voxel size to 0.25.  There is no width inaccuracy anymore.

I am going to remember that anytime you change the position of static objects in your scene you will have to re-bake the navmesh for things to work properly.  That seems like something that could easily ‘bite’ you in the future.

Problem: Not being followed

In the video the bunny is following the player but mine is just ‘walking’ in place.  Lets see if I did everything … ah there is an error in the code!  Actually as I look deeper it wasn’t an error in the code per se.  The code was looking for a game object with a tag of ‘player’, so I had to tag the player with that tag.

Unity3D Tag the player
Unity3D Tag the player

I went back to video 2 and confirmed that they DO tell you to tag your player with the player tag.  Mine wasn’t tagged so it was somehow my mistake.  I either missed doing it or I did it while I was in play mode (which cancels out everything you did when you exit play mode).  Done. Fixed. Moving On.

Topics and Implementations addressed in this section

  • Importing rigged and animated enemy characters
  • Particle systems
  • Shootable layers
  • Physics Colliders
  • Trigger Colliders
  • Nav Mesh Agent
  • Navigation Baking
  • Animation Controller for enemies
  • Enemy following player

Health UI

Video Duration: 14m07s

UI is large

They talk about how large the UI is in relation to the game units (one pixel per game unit) but they assure us that is not an issue.


Topics and Implementations addressed in this section

  • Rect Transforms
  • UI Pivots
  • UI Anchors
  • UI Canvases
  • UI Canvas Groups
  • UI Images
  • Making a health slider
  • Removing the button from a slider
  • How to cover your entire canvas with a UI element

Player Health

Video Duration: 17m10s

Some Health code that needs Tweaking

I wired up a way to cause myself to take damage (just so I could test it out) and I noticed that even after I was dead I was taking damage and making “ow!” sounds.  I checked to see if I was dead before taking damage and that fixed it.

Problem – Slider is not working

I went back and looked closely at what I had done compared to the slider in video 5 and found the problem.

The problem was that the Min Value was set to the same value as Max Value.  As soon as I changed Min Value to 0 it all worked!

Topics and Implementations addressed in this section

  • Script Interactivity (from one script to another)
  • Player Health Management
  • Player taking damage from beasties
  • Lerp-ing from one color to another over time
  • Collision Spheres (OnTriggerEnter)
  • Affecting a GUI slider with real game data

Harming Enemies

Video Duration: 41:03

Wow.  This is the longest video so far by far.  Its an important topic but having never watched it (as of the time of the writing of this sentence) I wonder what kinds of things are we going to be doing that would take 40 minutes!?!  I guess we are about to find out!

Ok the first 10 minutes is a walkthrough of code they have already written for you which will give health to the enemy (aka the ZomBunny) but I found it interesting that when you view the animations for the Zombunny you find that it just calls a public function called “StartSinking” whether it is there or not.

Then they spend way too long explaining block comments which is a pretty standard programming thing.  I realize that not everyone will know what they are and that some people will benefit from them, but they have assumed a certain level of experience thus far and could have stuck with that IMHO.

Major Discrepancy: Line renderer

Well when it comes to changing the ‘parameters’ of the line renderer … well … there ARE no ‘parameters’!?!  So I’ll try to figure out what to do instead.  ok I’m back and I’m still not sure what to do so here’s what I did:  I made Width = 0.5 and dragged that little red dot on the graph down to 0.1.  When I tested the work we did in this section that looked just fine, but there might be a more ‘authentic’ way to do it (so to speak).

Unity5 line renderer problem - no parameters anymore
Unity5 line renderer problem – no parameters anymore

After this they walkthrough a script for 15minutes then they test the game.  A few things I noticed: My gunshot sound is quite a bit lower pitched than theirs.  Also my player shoots much slower than theirs.  The gun sound doesn’t matter, but the player shot speed does; I fixed that by going to Player->Player and changing time between shots from .15 to .12 (its a very sensitive value).

P.S. The error at the bottom of the screen about a navmesh is deliberate (they mention that in the video but I wanted to give you a heads-up!)

Overall this was a pretty easy section without too many problems.

Scoring Points


In this section they are making a score UI and setting it with values when you destroy the enemy.  It talked about static classes and class data and when that will be useful in this section.  I encountered no problems during this section and I think it was well done.


  • Use of Static Variables

More Enemies

This one starts out with a puzzle: The prefab they are suggesting that we use isn’t there!?!

Prefabs aren't in the folder
Prefabs aren’t in the folder

At around 1:00 in the video is suggesting for us to use the Zombear from the prefabs folder but in my prefabs folder its not there!?!  Well that is true and this is a legitimate small error in the tutorial but I found it somewhere else: in _CompletedGame/Prefabs its in there.

Similarly the “Character” they refer to are not in the “Characters” folder but instead in the “Models/Characters” folder.

At about 9:00 in it shows you how to spawn new enemies and I feel like this is a particularly elegant solution in a number of ways.  It lets you have multiple spawn points, invokes a function regularly (I honestly didn’t know about that trick), and stops trying when player health is zero.  It also is modular so you can drag more than one copy of this script onto your enemy manager to spawn different enemies.

At the end of the video I encountered a problem because one of my enemies was moving around but the other two weren’t.  hmm …I’m going to try not spawning enemies but simply placing one in the game world and see what happens.  Ok I solved it by removing the “enemy Health” and “Enemy Movement” scripts and re attaching the components from our scripts folders.  For some reason that worked.  I suspect it was using slightly different (and broken) scripts from the _CompletedGame/Scripts folder.  Sure enough they are different in one fundamental way: they use a different namespace.  For that reason you will need to copy over the Enemy Attack script as well.  If you want to go all the way you will need to also add the death sound to the enemy health script.  When you do the settings will be different:

Hellephant Settings
Hellephant Settings
Zombear Settings
Zombear Settings

Yeah replacing all of those scripts seemed to do the trick.  and the game actually works really well now and is pretty fun!

The Game is Pretty Fun Now
The Game is Pretty Fun Now


Game Over

This is a really cool section.  In this section we are going to make a cool screen that overlays the game showing when the game is over but more importantly I think they show us how to animate any property of anything in the game!

The process to create a new animation has changed: In the video they refer to something called “Add Curve” now its called “Create”:

Create an Animation
Create an Animation

After that they show you how to set all of the values which is straightforward, then they drag a script onto your HUD Canvas, however the script they show in the video has one important thing that the script included in the assets folder does not: a restart timer to reload the level after a certain amount of time has passed.

If you want to add the restart time then this code should do the trick:

restart Level Code
restart Level Code

(note lines 4 and 26 in my code which are significantly different than the video)

I tried running my game without that restart timer code though and everything worked just fine!  The game even restarted after a second or two!  That must be an artifact of how they designed some of the other components of the game but boy it works great!


  • Animation of any public property of anything in the game
  • Doing something after a certain time has elapsed
  • Triggering an animation to begin


Final Words

This was an incredible tutorial.  You end up with a fun game and with understanding almost everything that they did to make it.  I’m really impressed with the quality but I still saw quite a bit of tutorial rot so I’m glad that I struggled through and documented what I found here for you.   Hopefully it was of benefit to you and I hope you learned a ton from the tutorial and got less frustrated thanks to my meta-tutorial.  Best wishes and let me know if you have any questions or comments!

Leave a Reply

Your email address will not be published. Required fields are marked *