Making a RTS game #1: Placing buildings (Unity/C#)

Let’s make a RTS game using the famous Unity game engine!

This article is also available on Medium.

Today, I start a series of video game programming tutorials on how to create a RTS game using Unity. This well-known, high-performance game engine is amazing and really allows you to create incredible stuff; the best part is that, in my opinion, the free version already has enough features for us to make most of the projects we want. Even if it takes a bit of time to get used to the software interface, the inspector and all the component-based logic, I find it is still a super fun and intuitive way to create games once you get the hang of it!

Disclaimer: This article does not go through all the Unity fundamentals. If you are not used this framework yet and want to learn some basics, check out their great tutorials!

Real-time strategy (RTS) video games are those games where you control packs of units, create buildings and collect resources to build a little town or city. They often have an aerial orthographic camera and you act as a somewhat omniscient superior being that can macro/micro-manage their units all over the map. Contrary to “turn-based strategy games” where each player takes a turn at playing and the others have to wait until you (or the AI) finishes the turn, RTS forces the players to play altogether in a seamless and continuous way. Great exemples of this genre are the Warcraft/Starcraft series by Blizzard, the Caesar series by Impressions Games or the Empire Earth series by Stainless Steel Studios and Mad Doc Software.

A screenshot from the well-known Warcraft III RTS game (Blizzard), in its “reforged” version ( – Image from:

Note: besides having exquisite gameplays on their own, what I’ve always loved about those games is that they are often shipped with a game editor that lets you create, configure and then play with your own maps and scenarios. To be honest, those “in-between” tools that hide some of the complexity but still give you the freedom to give life to your crazy stories are partly what lead me to program video games with more evolved tool! 😉

For the first tutorial in this series, let’s start with one of the core mechanics of a RTS game: building placement. This is the logic that lets you:

  1. pick a building type to build
  2. prepare where you want to place it (while checking for/showing invalid placement)
  3. actually place it on the ground so that it is “fixed” and cannot be moved anymore
  4. (optionally stay in “placement” mode so you can create another building of the same type)

In this article, we will skip the first step and consider that we already selected the building type we want – we will see how to create the UI and buttons required to pick the type in a later episode. Here’s a quick peek at what we’ll have at the end of this tutorial:

Preparing some prefabs

At this early stage in our project, we don’t yet have game assets (like building or character models, sounds and musics, nice images and icons…). We’ll start off by using Unity’s primitives such as cubes, spheres, blank images, etc. We can however leverage the system of prefabs to easily prepare the game objects we want to instantiate in our scene as we play along.

Prefabs are a feature of Unity that let us prepare a game object with all of its mesh(es), components, scripts and other unique properties so that, when you need to add this object to your scene, it is already all configured properly. For example, imagine a complex character model with a script to control the movement, an animator to control the run and jump animations, an audio source to cast sound effects whenever you switch your weapon and some physics collider to interact with the environment when moving. If you had to reconfigure all of this every time you added the character to a scene (say when you change of game level and reload a new scene), it would be quite painful. Instead, you can configure everything once and then “instantiate” the prefab.

The other nice thing with prefabs is that all instances of the same prefab are kept in sync: whenever you modify something on the prefab itself, all instances will automatically reflect the change.

For our RTS game, let’s start simple. We will create two prefabs:

  • a “Building” prefab: it’s a simple cube that represents our most basic building type
  • a “Rock” prefab: this small object will be part of the world and block you from placing a building on top of it – you can use another cube (I will take a small 3D model I made for a previous game)

On both of these prefabs, we will have BoxCollider components to compute physics and collisions.

“Building” prefab

To create this prefab, first add a new “empty object” to the scene. Then, create a “cube” primitive and add it as a child of this empty object. Now, create a new folder in your project called “Resources”; it needs to be named exactly like this so we can load things from it in the code using Resources.Load(). Inside this directory, create another folder called “Prefabs”, and another called “Buildings” inside of it. Finally, drag your new game object into this folder to create a new prefab from it. You can then click on “Open Prefab” to edit the prefab directly.

Here are the hierarchy, visualisation and properties for the “Building” prefab:

  • We have a child object called “Mesh” (this is important because we will reference it in the code later on) that is the actual display of the object, our cube
  • We have a BoxCollider that matches the extents of our cube primitive; it has the “Is Trigger” flag turned on to prevent the colliders from blocking each other and to just send signals when a collision occurs
  • The prefab also has a Rigidbody component in “kinematic” mode: this will allow us to catch the collisions with the other objects without gravity truly affecting the building
  • And finally, we have a custom script on the prefab, the BuildingManager script: we will gradually add things to it in the upcoming sections so for now, just create a new C# file called BuildingManager.cs and add it to the prefab
  • When placing the “Mesh” child, make sure to move it half-way on the Y-axis: by having the “empty object” parent, we can set our prefab anchor point to not be in the middle of the object but at the center of the bottom face; this way, when we place the building on the ground, it will be actually on the ground instead of half-burried in it!

This picture shows a half-burried version on the left and the correct version on the right:

“Rock” prefab

This one is simpler. We directly import our asset, or create a cube, and the hierarchy doesn’t really matter. The important thing is to add a BoxCollider on the prefab with the “Is Trigger” flag on:

Creating some reference building data

It’s time to really start coding! The first thing we want to do is to have a list of all available building types. So let’s define a class to represent some abstract building data (a building type). It doesn’t need to inherit from the MonoBehaviour class  because it just holds some data:

  • The class has only 2 fields: the unique code of the building (that will be used to get the proper prefab and perhaps other specific data in the future) and the amount of healthpoints the instances of this reference will have when created
  • We use getters-only to better encapsulate the code: rather than exposing the variables directly from the class, we use private variables and create accessors to get them so that no one can update their value but the class itself

Now, we can create a globally accessible variable with a list of reference building data – today, we’ll just define it manually but ultimately we should load those references from a more easily modifiable data file. To centralise those global variables and make them easy to get, we’ll create a new C# file: Globals.cs. And this file will contain static variables or functions so they can be called without instantiating the script.

Creating building instances

We’ve defined our “abstract” data class. Be careful: it is not truly abstract from the C# point of view because we actually instantiate it to have our list of available buildings; what I mean is that we won’t directly represent this data on the screen but instead feed it to our real building instances – the ones that we place on the ground when dragging our mouse and clicking.

Those instances are handled by another class, Building:

We create a new Building instance using a BuildingData reference so it has all the required metadata. The instance also has a game object and transform associated with it, because it is an actual object in the scene. This game object is loaded from our “Resources” folder, it’s the prefab we created before. Also note that we have more complex accessors that in our previous BuildingData class:

  • for the _currentHealth field, we have both a getter and a setter (HP), because we might want a quick way to update the value from outside the class
  • the DataIndex accessor doesn’t correspond to any private field in the class, it is a “computed” property that gives us the index of the abstract building type data instance in the global list

In addition to those accessors and the constructor, we have a custom function to set the position of the game object in the scene, SetPosition().

Moving a “phantom” building with the mouse

In RTS games, it is quite common to have a “phantom” visualisation of the building you want to place before actually placing it on the terrain. This way, you can better prepare this placement and check that the building placement is valid. This “phantom” follows your mouse while sticking the soon-to-be-placed building to the ground.

To do this, we will use Unity’s physics raycast system: this allows us to cast a ray from the camera to the ground based on our mouse position; and therefore get the exact point in the 3D world on the ground that our mouse is pointing to.

Setting a layer on the terrain for optimized raycasting

To begin with, let’s apply a specific layer to our terrain – thanks to this layer, we will be able to check only the collisions with the ground when casting our ray (otherwise we would potentially get hits for all colliders on the way). The first step is to create and add the layer to our terrain in the Unity inspector:

To add a new layer, (A) first go to the Inspector and click on “Add Layer…”. You can now (B) name your layer (in the “User Layers” part that start with layer #8). After you’ve named it, it will appear in the dropdown and (C) you can select it! 

Then, we can define this layer as a global variable in our Globals.cs file (we simply use the index of the newly created layer, 8 – Unity uses bitmasks for layer masks):

Creating the BuildingPlacer.cs script and doing the raycast

Let’s create a new C# file called BuildingPlacer.cs . Since it doesn’t correspond to any particular game object but is somewhat global to the scene, we will:

  • create a new “empty game object” in the scene
  • name it “GAME” to show it has scripts that are global managers of the game state
  • add the BuildingPlacer script to it

Then, we’ll add this code to the BuildingPlacer script:

We use the _placedBuilding variable to know which Building instance (if any) is currently dangling at the end of our mouse pointer. Now, we can actually do the raycast:

Note: we will be implementing the CheckValidPlacement() method and the  HasValidPlacement property on the Building class very soon – for now, the code will not compile!

Very soon, we’ll have our “phantom” building follow the mouse and even climbing mountains! (And we’ll be able to press the <Escape> key to exit the “placing building” mode)

All that is left is to really place the building (which means making it stick to the click position instead of the mouse, and take a new “phantom” building to replace it)! To do this, we will:

  • use an enum to represent the possible placement states, BuildingPlacement
  • initialise the placement to be “valid” at the beginning (while in “phantom” mode)
  • change it when placing the building

Let’s add two methods to the Building and the BuildingPlacer classes – and fix our _PreparePlacedBuilding() method so it doesn’t “erase” the previous building!

Note: when we place the building, we need to deactivate its “Is Trigger” flag because we want other objects to collide with it, now that is solid on the ground.

Checking the “phantom” building placement

Changing the building’s visual in case of valid/invalid placement

Before adding all the placement checks, we’ll put in place some logic to update the building instance materials and clearly show if it is placed or if it is a “phantom” with either valid or invalid placement. Indeed, a build instance can be in either one of those 3 states:

  1. “valid”: when the building has not been placed yet and is in “phantom” mode, if all placement checks are okay, then the “phantom” building should be displayed as a somewhat green transparent shape
  2. “invalid”: still in “phantom” mode but some placement check does not pass – then the building should use a red transparent material
  3. “fixed”: after really placing the building, we need to restore its original material(s) that are set on the building’s prefab (with our basic cube, it’s Unity’s default material)

So we simply need to add the “invalid” state to our previous BuildingPlacement enum possible values, and we need to define the two new materials “Valid” and “Invalid” in the “Resources” directory, in a “Materials” subfolder. Here is the “Valid” material, for example (using the transparent rendering mode and with an Albedo that has a non-1 alpha):

We know we need to remember the prefab’s material(s) so we can restore them. We also need a field to store the current placement state of the object. So, let’s add these fields to the Building class and initialise them in the constructor:

The next step is to actually update the materials of the mesh depending on the placement state. To do this we add a SetMaterials() method to our Building class (and we call it in the constructor and the Place() method):

Note: here, we used an override of the SetMaterials() function to handle the case we pass no parameters in.

 Avoiding collisions with other buildings or doodads

In games, “doodads” are all the little objects that bring life to the world, induce collisions and can’t usually be interacted with: trees, rocks, walls… Here, let’s say we have our little rocks on the ground and that we can’t place a building if it collides with a rock. To check for this collision, we’ll use the box colliders we added to our prefabs and the Unity built-in functions OnTriggerEnter() and OnTriggerExit(). This is done in the BuildingManager class:

Note that we need to ignore the terrain when checking for collisions; we use a “Terrain” tag on our terrain object to handle this distinction.

We need to call our Initialize() function when we select our building type so that the newly created Building instance can link its data into its BuildingManager script (remember we put this script on the “Building” prefab so it is automatically present on every new instance of the prefab):

Forbidding placement on too steep terrain

Finally, we don’t want the player to be able to place buildings on steep slopes, mountain sides… To avoid this, we will simply extend our HasValidPlacement() function. We’ll use raycasts as we did before: the idea is to project a ray from each of the 4 bottom corners of the “phantom” building box collider and check that it does meet the terrain at a relatively close distance (see the comments in the code for more details):


Pfiou, we’ve managed to program one of our core RTS mechanics and we can now place buildings on the ground, check for invalid placement and update both the building state and its display as needed! Next time, we will add a basic UI management system so we can click on a button to select the building type we want to place.

I hope you like this series and that you’ll be interested in the next episodes! 🙂

28 thoughts on “Making a RTS game #1: Placing buildings (Unity/C#)”

  1. Hello I think your tutorial is very interesting and I hope you finish it. I just don’t quite understand one thing. And the Sricpt Gobals.
    first write that in.
    // Globals.cs

    public class globals

    public static BuildingData [] BUILDING_DATA = new BuildingData []
    new BuildingData (“Building”, 100)


    then that.
    // Globals.cs

    public class globals

    public static int TERRAIN_LAYER_MASK = 1 << 8;
    // … ???? What does this place mean and if I delete the first one above. public static BuildingData [] BUILDING_DATA = new BuildingData []
    new BuildingData ("Building", 100) this sentence .. comes an error where it is said in gobals see no BuildingData ??? when I fade out with // another error occurs.


    Thank you for your reponse.

    1. Hi – I’m happy you like it 🙂

      I’m going to try the best I can but I’m not exactly sure I understand all of your questions…

      1. about the TERRAIN_LAYER_MASK = 1 << 8: Unity uses bitmaps to store the layer masks; so basically, when you want to use your Layer n°8 to do a mask in your raycast, you need to use this bitshift, where the right integer is the index of the layer (in my example, 8)

      2. not sure why you get an error on BuildingData in your Globals.cs... are you sure your BuildingData.cs file compiled correctly? If not, then the other script won't be able to get the class and you will get this error.

      (3. when you commented out this block, you probably got a null reference error because other scripts assume this variable exists)

      Don't hesitate to tell me if it helped you a bit, and to ask any other questions you may have! 😉

    2. I also had this problem. I hadn’t properly attached the “Mesh” cube, as a child, to the empty “Building” game object. This caused a null reference when my transform tried to find the mesh.

      There isn’t a problem with the globals.cs. The problem is how you structed your building game object in the editor.

      Thanks for the tutorial.

  2. Hey,

    Just found this on medium
    Was wondering about starting an RTS as a pastime to make with my brother(who is into 3D modelling and such)

    I find the tutorial really well made. I like that fact that you have some good coding naming conventions and file structure.

    I just wanted to maybe suggest that you check the order in which you add your images.
    Sometimes you only display the initialisation of variables(such as the _placement or the CheckValidPlacement checks a few pictures after you implement them.

    For example on the Update() of Building placer. I’d get an error in one of the IF statements because _placedBuilding does not have a HasValidPlacement parameter yet.
    Meaning I’d have to hope everything works thusfar and then keep going with the tutorial or comment that bit out untill you finally bring in that method/variable.

    It’s a minor gripe but it would make following along with this alot smoother if I didn’t have to worry about whether an error was my mistake or just a variable that gets created later.

    1. Hi, I’m glad you like the tutorial 🙂 This is a very acute comment – to be honest, it’s because I started the project before the tutorial and then “reworked it back”… I tried my best to avoid those errors, and hopefully the next tutorials are better because I wrote them as I was doing the code, but there may be other little mistakes.
      I hope there aren’t too many, though – and don’t hesitate to tell me if you spot others! 😉

      1. Your reply was insanely fast.
        I thought that was the process.

        I can try make a list of the errors that I do notice?
        But I don’t think it’s as beneficial to you to redo this tutorial just from a time standpoint.

        Rather as you say just keep going and make your next tutorial the best one yet!

        1. Haha, you can thank the email alerts for me answering this fast 😉
          You’re absolutely right – I did add a little note in this first tutorial to mention that the code would not compile immediately, but yup – I’ll definitely work on improving my skills rather than my old blog posts!
          I’ve already learnt a lot from writing those and discussing with nice people like you – comments and exchanges are the best way for me to learn from my mistakes 🙂

          Hopefully you’ll like the rest of the series and perhaps even see me improve as we go along (a girl can dream…) ^^


  3. Awesome tutorial however I have run into a problem.

    I have completed the tutorial and have followed it to a tee, however I am left with a problem. I am unable to place the building. I have the green “phantom” building, but it refuses to be placed down. I can play the game within Unity and no errors appear. What could be an error and how can I fix this?

    1. Hi – happy to know you find the tutorial interesting, thanks! 😉 It’s a bit hard to debug from here with just those info… perhaps the HasValidPlacement() function isn’t working properly? Do you get a valid color switch from green to red?
      If you want, you can send me your code and I can take a look 🙂

      1. Hi Mina.
        I have started this tutorial yesterday and I literally encountered the same issue even after following it to a Tee. I can confirm.
        After debugging for a while (Attached debugger to Unity and switched to debug mode in the inspector) I noticed that the Building reference, the variable _placedBuilding is actually null and it doesn’t show into the console. The reason I suspect is probably the instantiating of the building instance with a pure constructor inside a Monobehaviour could be the culprit, since the building instance is a monobehaviour. the warning message shows that it asks for AddComponent rather than instantiating a new instance using a pure parametrized constructor.
        The problem with this is AddComponent doesn’t have an overload for a value of any object. Hence a compromise happening under the hood, I suspect.
        This is honestly annoying and unity should really make an overloaded parametrized AddComponent (I am too lazy to make an extension method)
        Could you please look into it? I would appreciate the time you take for this. ^^’
        Thank you very much.

        1. Hello! Happy to know you’re interested in the tutorial, but sorry you’re having some difficulties ^^
          So – I’m not exactly sure which MonoBehaviour you are referring to here: if you check the code snippets, you’ll see that the Building class is a simple “pure” C# class that does not derive from the Unity built-in MonoBehaviour class; so you should be able to create a new Building() instance and inside it to the _placedBuilding variable…
          Or perhaps I’m not understanding your issue right?
          Please feel free to ask again with more details if that doesn’t answer your question and/or doesn’t fix things!

          Cheers 🙂

  4. This tutorial is truly amazing and one of (if not) the best tutorial about making RTS games I’ve seen so far.
    You are doing really a great job! And thank you for the time and effort you put into making this.

    Do you have a plan how far you will take this tutorial?
    Do you, i.e. plan to implement an AI player? I would love to see a basic AI pattern für RTS games. =)
    Do you plan to implement multiplayer in any way? I know both of these questions cover the “godlevel” of RTS coding, but a question doesn’t hurt. 😀

    1. Thanks so much for your nice comment – I’m really happy you like this tutorial and find it useful! 🙂

      To be honest, I plan on going on for as long as I have ideas ^^ and I still have some…

      Haha, you’re actually tackling THE 2 questions I’m wondering about 😀
      I’m definitely planning to add an AI player at one point, but I’m still working on it to see if I can come up with something robust enough at the moment. It might get introduced in the series of tutorials in a few weeks/months (at least for a “simple” version)…
      For the multiplayer mode, I’m also thinking about it but I haven’t yet managed to get a comprehensive enough understanding of Unity’s multiplayer to feel at ease “teaching” others. So perhaps in a while – that would be a really, really cool feature indeed!

      1. Hi, thanks for your fast reply.
        At the moment I’m diving into multiplayer creation via PUN Plugin and try to sort out my best way. PUN is one way, the Steam API is the other way I like to look up. PUN seems to be much easier at the moment, but on the long hand I’d prefer the Steam API. I’ve once read an article by Lance Talbert about Unity and PUN which lead me into that way, perhaps you like to take a look.

        Anyway, it will take some time until I reach the end of this amazing tutorial and I really happy to see what is coming allong the way.

        Best wishes

        1. Hi,
          yay, thanks a lot for the reference! I’ll be sure to check out Lance’s tutorial 🙂

          I’ve taken a look at Photon, and Mirror a bit too so far… haven’t yet had a look at Steam API. In truth I’ve never dived into networking as much as I wanted to during my game dev journey, hopefully I will manage to one day ^^

          Btw, don’t hesitate to tell me if you have any ideas of nice features I could talk about in this tutorial, I’m sure lots of have slipped my mind…

          1. Heyho,

            as a Game Designer I do not have a lack of ideas. =) But not all are suitable for an RTS approach.
            But here I have two for you. 😉

            1) Task System – You could implement a (per player) task system for non-controlable workers. These workers could normaly take on the transport mechanisms and carry goods from A to B. This is of course only necessary if you have a physical presence of your goods and need to transport them (see The Settlers). But apart from not being part of your scope, this task system would be a cool thing to have inside a tutorial.

            2) Borders – Perhaps you like to implement borders for your empire. So you can only build inside those borders and have certain buildings that are able to expand those borders.

            Hope you like those ideas. 😉

            And as a small joke-ish idea: What’s about a shield emitting building, that is able to create a projectile removing force-field in an small (but adjustable) area in front of the building.

            Best wishes and keep on the good work!

          2. Nice one! Yup the Task System doesn’t quite fit for this series since I’m doing more of a “theoretical resource gathering” à la Industry Giant, but the idea’s really cool – I might work on this as a standalone Unity Tutorial 😉

            I was indeed thinking of something with borders/max distances to have sort of a “herding instinct” and push the player to build its city gradually… (in any case: I’ll have to prevent the player from building units out of its FOV ^^). I’ll try and find something nice along that vein!

            Huhu, the shield emitting building might be a great core feature for an action/arcade game where you have to defend against enemies instead of coming at them?… dunno, anyway, it’s a fun idea!

            Thanks for all of this, and don’t hesitate to pop in from time to time if you have new crazy ideas 😀

  5. Hi,
    I bugged a little bit with setting the materials…

    In the SetMaterials() function the materials.Add(refMaterial) doesn’t add any material to the List of materials. As a result I can’t see my floating cube, because the array length is 0.

    I used a few debug prints to pinpoint this behaviour…

    public void SetMaterials(BuildingPlacement placement)
    List materials;
    Debug.Log(“placement: ” + placement.ToString()); // Result: VALID
    if (placement == BuildingPlacement.VALID)
    Material refMaterial = Resources.Load(“Materials/Valid”) as Material;
    Debug.Log(“refMaterial: ” + refMaterial.ToString()); // refMaterial is loaded as Valid
    materials = new List();
    Debug.Log(“Material count_B: ” + _materials.Count.ToString()); // _materials.Count = 1
    for (int i = 0; i > _materials.Count; i++)
    Debug.Log(“material count_C: ” + materials.Count.ToString()); // materials.Count = 0

    I do not get any errors (or warnings) and I am able to plant the building cube on my mouse position by left clicking, so everything works like a charm except I can’t see the ghost. =)

    1. Hello! Happy to know you’re going through my tutorial, thanks 😉
      So – I’m not exactly sure if this is a copy-paste of your code or not, but I’m guessing that’s because your for-loop has a i > _material.Count check… 🙂

      You can also check the “official” version for this function on my Github if you want, over here (just ignore the rest that comes later in the series).

      Hope this helps, cheers!

  6. Hi Mina,

    I just thought about two things that are not really features, but important topics for an RTS game. And even though there are allready a few tutorials for those topics out there, it would be wonderful to have them out of one hand, if you know what I mean.

    1) Later in this tutorial we will have movable characters. You used a place holder, but to get another tutorial topic, what about animating a character model?
    I found this one in the store ( and would love to see this unit be integrated into your tutorial. This will give (me) a step on animation, rigging and (more important) importing stuff into one of my projects.

    2) You use some pretty underground as terrain. For an RTS it would be wonderful to get one or two methods to create terrain (perhaps with unity tools or with a tilemap).

    What do you think?

    Best wishes and keep this amazing work going!

    1. Hello again!

      Yay, more ideas 🙂 thanks!

      1) I absolutely want to do something with animation: I’ve done a quick intro to it in a recent tutorial of this series (episode #) but it was Sprite animation, and it was a light overview of the topic. The thing is that I have trouble using assets from other people (even if they’re free, it’s just me, I know, I’m crazy, but I like to do everything from scratch ^^)… so in my head an episode on character animation means I need to model and rig a basic character to share, too :p

      But anyway – even if I get passed this, it would probably need several episodes because explaining the whole workflow of importing and using a rigged character asset could be pretty long. So in truth I’m keeping it in the back of my head but waiting until I have more time to write it down 😀

      2) Totally right! So far I’ve “just” used Unity’s built-in terrain tiles, but I should definitely do an episode on how to import and use those. I’ll think about it and schedule it 😉

      Thanks again for your nice comments and your ideas… keep on going like that and we’re gonna end up doing game dev together! 😀

  7. Hey there!
    Was looking into RTS myself and found this, figured I would attempt it, since I am coming from making a couple VR games.
    The issue I am having is similar to a couple others, no errors.
    The cube spawns at 0,0,0, is green, and if I click the mouse it goes red and pops another (Clone) in the hierarchy. I can’t move the cube with the mouse or place it anywhere but 0,0,0.
    I went to the github but that is the project current, not broken down by ‘lesson’ but I compared what code we have to that and it matches up for the most part (you did add to this a bit).

    1. Hi!
      (Yep the Github only got separated for each tutorials starting with episode 25, sadly it was my first big project of the sort and I didn’t prepare everything properly at the beginning – sorry about that! :/)

      Perhaps the problem could come from your layers/tags settings? This could “break” the raycasting logic and therefore prevent you from having the phantom building follow the mouse…
      I’ll admit I don’t have any other idea what the issue could be out of the blue… if you want, you can send me more details or even your current Unity project by email (or share a Github repo) at

      I’d be glad to see if I can help you fix the error!
      Cheers 😉

      1. Thanks for getting back to me.
        I did fix it…I realized, a bit late, that I forgot to set the layer for the terrain (I was sure the code set it but…no…). Once I did that, worked fine.
        Currently confused on tut 6 or whichever is setting the healthbars (my health bar is always off screen and negative) and the next lesson I think as well (decided to move on). I also can’t select units individually (only the drag works) and no buttons appear…haha..I broke it good!
        Might have to just send you the project to see if you can clear it up so I can keep following along.
        But I don’t want to put you out!

  8. Hi. This is a wonderful tutorial. I am pretty new to the engine and game development in general. Can you please tell where do we place the terrain in the hierarchy?

    1. Hi – thanks a lot for your nice comment, I’m really glad you like the tutorial!
      The terrain is usually placed at the root (you can see it as one of the main “sections” of your scene, so it makes sense to have it as one of the root node 😉 ).

      Cheers 🙂

Leave a Reply

Your email address will not be published.