Build a 2D Top Down Game – Zero to Published – Part 3

Welcome to part 3!  If you have not completed part 2, please go back and complete part 2.  This part will cover creating prefabs for your level, creating a level and then optimizing that level.

Part 1:  Getting Started

Part 2: Animations

Part 3: Prefabs

Part 4: Enemies

Part 5: Modular Scripting

Part 6: Timed Prefab Instantiation

Part 7: Health Bars

Part 8: Finishing Touches

Part 9: Publishing

Create some obstacles!

  1. Find the crate and drop one onto your scene.
  2. Click Add Component, Physics 2D -> Box Collider
  3. Drop some tileable Brick down on the scene.
  4. Now lets border the brick with the crates.
  5. ResourcesLaidOut
  6. OH NO!!!! Things disappear and act funny.
    1. We need to adjust the layers they are sorted on.
    2. Navigate to Layers and edit.


7.  Navigate to the sprite renderer component of each of the game objects and set them appropriately.



  1. Navigate to the prefabs folder. Right click -> Create ->Prefab.
  2. Highlight multiple objects you want to be a prefabricated component and drag them onto the view of the pre-fab in the projects view.
  3. Delete the objects from the view.


Create a few more prefabs of scenery.

Create LOTS OF PREFABS!  I like to create prefabs of pieces of scenery that I think I will use commonly for building a level. Below is an image of all the prefabs I built for the starter kit of this game.


Create a Level using your prefabs


Optimizing your prefabs

  1. Drop the prefab you want to optimize onto your scene.
  2. Look at all of the box colliders you have for each crate.  That’s a lot of box colliders, we don’t need that many.
  3. Delete the colliders from each of your boxes.
  4. Create a new box collider that covers the entire space of the old colliders.
  5. Drop this set of objects back onto the original prefab to save the changes to all of the prefabs already created.


Notice the left collider covers the entire wall, while the top wall section has individual colliders for each crate.

0 thoughts on “Build a 2D Top Down Game – Zero to Published – Part 3

  1. Pingback: Build a 2D Top Down Game - Zero to Published - Dave Crook's Dev Blog - Site Home - MSDN Blogs

  2. Pingback: Build a 2D Top Down Game - Part 9 - Publishing - Dave Crook's Dev Blog - Site Home - MSDN Blogs

Leave a Reply

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