![]() |
When you choose an object in the Hierarchy, the objects detail will show in the Inspector window (on the right). This is where you can make changes to the object, add textures, add colliders and add code.
Let's get the camera in the correct position. Choose the Main Camera in the Hierarchy tab. Now look at the Inspector tab and on the right, under Transform, you will see Position. Type 265, 20, 20. Your camera should now be in the position where we want it.
![]() |
Now let's add a texture to the terrain. Choose Terrain from the Hierarchy tab and click the paint brush in the Inspector window. Under Textures you will see Edit Textures. Left-click and choose Add a Texture, and a small window will pop up asking you to choose a texture. Once you click that box, the textures you imported from the Asset Store will show. Double-click and add one you like. I chose Dark Concrete.
Look Into the Sky
Unity comes with a default skybox which works great if you like it. I think it's a little boring, so I'm going to add the skybox we downloaded earlier. Let's click Main Camera and in the Inspector window click Add Componentat the bottom. Type Skybox and click the circle on the right. A box will open where you can choose a skybox of your choice by double-clicking it. Now if you look in your Game Scene you will see the new skybox. Looking good so far!
If You Build It
Now that our environment is coming along, let's add some buildings. Go to Game Object > 3D Object > Cube. At first, you won't see the cube because it's at a far distance. Let's get it to where we can see it. Click on Cube from the Hierarchy. Let's position the cube by typing 300, 25, 100. Let's also scale it to 20, 50, 20. You can use the scale tool or just type the size into the boxes. Once you've added the first Cube, right-click it in the Hierarchy tab to rename it. Name it Building 1.
![]() |
Awesome. Let's add some more buildings. Repeat the steps above. You will see the additional cube in your Hierarchy as Cube (1), so let's rename it Building 2 by right-clicking your mouse and typing it in. Now scale to 20, 70, 20 and position to 275, 25, 100.
As you add buildings, change the scale and position for each one. Make sure you keep the middle positions at 25 to keep them lined up. You can also use the toggle bar to scale and move the buildings. Continue the steps until you have five buildings, and name them consecutively, for example Building 2, Building 3, and so on. I have my buildings positioned by skipping 25 numbers like so: 250, 0, 100, 225, 0, 100 etc. Don't forget to save your scene!
Tip: You can also right-click a building in the Hierarchy tab, copy and paste it.
Adding Building Textures
Now we get to turn our cubes until buildings. Click on your Artwork folder in the Project tab (this is where you added your building textures). Choose a texture and drag it to a box on your Scene tab. You will immediately see the texture change in your Scene and Game views. Feel free to adjust, move and rotate your buildings until you're satisfied.
Tip: At times the texture can be backward. An easy fix is to rotate your box by changing the Z rotation to 180.
The Road Ahead
It's time to add the road. Go to Game Object > 3D Object > Plane. Position it at 250, 0.2, 80. Add a Y rotation of 90 and scale it to 1, 1, 15. Now choose your road texture and add it to the plane. Rename the plane Road.
A Place for Everything
Final Unity projects can have thousands of objects, scripts, and prefabs. It is important to keep your items organized, and now is a good time to organize your Hierarchy.
Any city is made up of numerous buildings, so let's keep ours itemized by the block. Go to Game Object > Create Empty, and you will now see a new item in your Hierarchy named GameObject. Rename it Block1(L). Click building 1, hold down Shift and highlight all of your other buildings. You can now move them all under Block1(L) which becomes the buildings' parent.
![]() |
We will now create the other side of the street. Right-click Block1(L) and copy and paste. Name it Block1(R). Position Block1(R) to 235, -90, 300.
You can now change the textures around or download new ones if you wish. When changing a texture, you must click the individual box, otherwise you will change all the textures for the block. Let's reposition the Camera to 340, 10, 80 and rotate to -80.
Tip: If you don't like the way an item is positioned, you can move it with your toggle menu. Click save.
Adding City Props
From here on out we will need to use the toggle bar. Practice using the right and left mouse buttons to move around your world. It takes a little practice.
Click the down arrow on the City Props Pack folder in the Project tab. Scroll down to the Prefabs folder and click the down arrow until you see the list of objects. Choose the Stop sign. When you choose it you will see it displayed in the Inspector window on the right.
Let's move to the front of the first building. Choose the Stop sign and drag it to the Scene window; depending on your scene, you may need to scale it down. Scale to 0.2, 0.2, 0.2. Great!
Let's get creative and add more props. Feel free to choose the ones you like and place them anywhere you like on the sidewalk. Remember you can copy and paste any object in your Hierarchy. In the spirit of keeping things organized, create an Empty parent under Game Object and call it City Props. Move items accordingly. Save your scene.
Tip: Remember, if your objects glow white, you will need to change the shader to Legacy Shaders/Bumped Diffuse.
Adding Trees
Now it's time to add some trees to our city. Unity comes with standard trees that work great. You can always download different types of trees from the asset store if you are going for a different look.
Let's click Terrain in the Hierarchy tab. In the Inspector window, you will see a picture of what looks like a tree under Terrain—click it. Under the settings, change the Brush Size to 1. Now click Edit Trees > Add Tree. In the Tree Prefab box, click the circle at the end.
Choose a tree (I chose Broadleaf). Double-click and add. You will now see the tree you chose under the Trees box in the Inspector tab. When you move your mouse on the Scene, a blue circle will follow. Since we have the Brush size on 1, you will place one tree at a time. If you add a tree and it's too large, you can resize under settings by changing the Tree Height. If you make a mistake, click Edit Trees and remove the tree. You can then start over.
![]() |
OK, so we finally have our environment where we want it, and now it's time for our friend Ethan to walk around in our world. Click the down arrow under Standard Assets from the Project tab, then Characters > ThirdPersonCharacter. Go into Prefabs and drag the ThirdPersonController into your Scene. Position the controller at 315, 0.1, 78 and resize to 3, 3, 3.
You can also rotate him so he is facing the direction you want. Click Play, and you should be able to control Ethan. Click the arrow buttons on your keyboards and run around.
At some point, you will notice he moves off the screen, so we need the camera to follow him. Under Hierarchy, highlight the Main Camera and drag under ThirdPersonController. Your MainCamera should now be a child of the ThirdPersonController. Now when you hit play, the camera will follow Ethan.
Adding a First-Person Controller
We can also view our world in the first-person view. Go into your Project tab. Choose Standard Assets, Prefab, FPS Controller. Drag it to your scene, rotate and scale. Before you hit play, it is important to note that the FPS comes with its own camera, so you will need to delete the MainCamera.
Tip: If your character falls through the ground, you probably have them positioned too low. Double-click your character on the Hierarchy tab and you will see a close-up on the Scene tab. Move the controller up with the arrow bar or position the Y at 1.
Congratulations! You have built your first 3D City in Unity 5! As you can see, it's easy and lots of fun. You can get as creative as you like and add houses, cars, stores, etc.
Written by Sandra Gerber
If you found this post interesting, follow and support us.
Suggest for you:
Unity 5 Professional Guide - Develop a 2D Arkanoid Game!
Unity 5 Professional Guide - Mastering C# Programming!
Make VR Games in Unity with C# - Cardboard, Gear VR, Oculus
Learn to Code by Making Games - The Complete Unity Developer
Start Learning Unity3d by Making 5 Games from Scratch





No comments:
Post a Comment