Introduction to Unity3D

1,043

22

18

Introduction: Introduction to Unity3D

The Unity3D Game Engine provides an excellent framework for an aspiring game designer, such as yourself, to create amazing and detailed game levels with absolutely no programming required! This guide will show you step by step instructions for creating a fantastic low polygon (low-poly) environment in just a few steps. First thing's first. you'll want to download a copy of Unity3D if you don't have it. Don't worry, it's completely free for enthusiasts!

Step 1: Downloading Unity3D

If you already have a copy of Unity3D, feel free to skip this step! If you don't, we're going to download it before we get started.

Head on over to Unity's website to download your copy. Complete the required forms, and download Unity. Run through the installer. At the very minimum, I recommend selecting "Standard Assets", and "Documentation". Beyond that, feel free to select any number of optional packages and continue.

Step 2: Launch the Editor

Now that you've got Unity, launch the editor. Once opened, it should look a little like mine. Now, we're going to access the Asset Store to find some free assets (or buy some, like me) to use for our level design. Remember, we're going to design a low-poly environment, so we want low-poly assets. If you're not sure what that looks like, have a look at the picture included in this step to get an idea.

What is Low-Poly, you ask?

  • Very few polygons, which are the shapes that make up a mesh.
  • Very minimal coloring, often flat color instead of a high resolution texture.

Why would we use low poly when we have [insert names of amazing graphics cards]? Well, low poly is an excellent game design step for learning basic level layouts with a pleasing aesthetic. These environments often feature intense colors yet are not overwhelming, and can be used to evoke the feeling of a retro game without actually subscribing to the legacy graphics such games might have had.

Step 3: Browsing the Asset Store

Anyway, let's open the Asset Store. At the top, select "Window" > "Asset Store" to open the asset store. You should see something like the picture above. I've searched for Low Poly, and selected a few models to show off here, as a proof of concept that you could complete this guide without a single expense. Having worked on projects like these myself, I will be using a collection of paid assets. I will include information about them at the end of this tutorial, if you intend to purchase them as well!

Pick a collection of assets or two, and move on to the next step. Ideally, you will want to pick assets from the following categories.

  • Vegetation (Trees, Bushes, Grass)
  • Buildings (Town, Village, or Decrepit)
  • Models (Shovels, Axes, Tools, etc)
  • Animals (you know, like animals?)

Once you feel you've met these categories sufficiently, move on to the next step. Remember, there's no such thing as too many assets! Go crazy :)

Step 4: A Warning About Piracy

This is a disclaimer regarding piracy. It may be tempting to try to find paid assets online for free. However, I will discourage you from this for two reasons:

  • More often than not, the thing you're downloading is a virus. Yeah, I know you're an expert at the internet, but I'm just saying.
  • The developers of these assets are insanely talented artists who put a lot of work into their products.

If you choose to not listen, at the very least, consider purchasing their assets if you like them enough. This not only supports your work, but eventually will allow you to legally market your work without the chance of legal action.

Okay, adult warning step is over. Let's get busy.

Step 5: Get Organized

When you import a lot of packages from the store, you'll notice that a lot of assets have their own folders named after whomever made them. In my experience, while leaving them in their original folders may seem useful, I prefer to consolidate my assets into groups. In this step, I made a folder for each category of asset I have, which enables me to have better creative control of my environment

This step is optional, but I highly recommend doing it before continuing. There's nothing more annoying that realized "Oh wow I totally forgot about this folder I downloaded full of amazing assets" and having to manually delete scene objects later to integrate them.

I've also made a folder called "Data" where I store the remaining asset data that I'm not sure I can delete. This can include Materials, Textures, or PDFs and Documentation.

Step 6: Previewing Assets

This helps you get a feel for the different artistic styles you will be working with. It is possible that you may not like the styles of a certain artist, and this is your chance to remove these assets ahead of time. If you're not sure what an asset looks like, just drag it into your scene! See the video for more help.

To navigate the 3D Scene, navigate to the 'Scene' tab at the top and open it. Then, holding down right click, use "WASD" on your keyboard to fly around. You can press shift to go faster if you're far away. Another tip, if you press F at any point, the engine will focus the object in whichever window you're in. In other words, hover your mouse over the Scene view, and press F while an object is highlighted, and it will fly you over to it. If you do this with your mouse over the Hierarchy to the left, it will highlight the object in your list.

See my video at the top for more help with this.

Step 7: Terrain: Creating a Basic Terrain

We're going to create a basic Terrain. Unity gives us an amazing tool set for working with these terrains, including sculpting and molding tools to make any terrain your heart desires. First, go to "GameObject" > "3D Object" > "Terrain" to create a terrain. Hover over your scene view and press 'F' to find it.

See my videos at the top for help. Next, you'll want to scale the terrain and paint some mountains. In the second video, I show how to apply a grass texture to the terrain to change it from white (which is hard to see) to a nice dark grass. Then, I change the terrain size to 1024x1024, but you can feel free to leave it at 500x500. Finally, I select the terrain elevation tool, and mess around with the settings to get it to paint small elevated terrain.

Take some time here to familiarize yourself with the different tools. You can use the flatten tool to flatten terrain to a specific height. Press Shift with the tool equipped and left-click to select a height. Then, whenever you click, the terrain will be pushed toward that height. You can use these tools to create some basic terrain features.

We want mountains, but not huge ones. We also want small changes in elevation in the terrain to keep it interesting. When you feel ready, move on to the next step.

Step 8: An Alternative Approach to Terrain Creation

You can also use height maps to create a terrain, using a tool like Photoshop. Unity can import "raw" file format as a method of selecting for terrain height. To do this, open Photoshop, and create an image with the exact dimensions of your terrain. The terrain must have a power of two size, such as 512, 1024, 2048, etc and set the image type to Grayscale and RGB8. Then you can simply paint between white and black to select for terrain height.

In this case, I found a height map on Google Image for an island, and I imported into Photoshop. Then, save it as a RAW image format, and go back into Unity. Follow the video above for the following steps:

  1. Select the Terrain in Hierarchy.
  2. Go to the Settings tab in the Inspector.
  3. Scroll down to "Import Raw".
  4. Select your Photoshop image.
  5. Make sure you properly set the size of both your terrain, and the source image (if not auto-detected).

Note that the "Byte Order" refers to the system you created the file in. If you create it on a Windows Photoshop, select "Windows". Otherwise, select "Mac".

See my screenshot above? Notice how the terrain is very rough. We will be using the smoothing tool to get it to play nice. The left side of the image shows my smoothed section, and the right is un-smoothed. Grab a coffee, set that brush size to max, the opacity to max, and get to smoothing :) I'll see you in the next step.

Step 9: Terrain Toolkit, Our Hero!

I highly recommend Terrain Toolkit for this next step. It is available on the Asset Store for free! It gives us huge control of terrain shape and texturing. We will be using it for the next steps to apply texture to our slopes and ground, as well as smoothing and eroding our terrain to give it a more natural feel.

Fun fact: This toolkit was originally created in 2009 and never available on the Asset Store, being referred to by word of mouth. Now it's on the store, and you're in luck. It's an amazing tool, and is very free!

Select your Terrain in Hierarchy, and then under the Inspector, select "Add Component" at the bottom, then type in "Terrain Toolkit" and select it. It will attach the script to the object. See my video above for help with this! In this case, I apply a few passes of smoothing to help with my rough terrain. You can also play around with the erosion features to create more natural terrains.

Step 10: "Let There Be Texture"

We're going to procedurally texture our terrain now. We could sit there and hand-paint the textures, and hey, if you're dedicated enough, go for it. But I'm not. I'm very lazy. So we're going to use Terrain Toolkit. In my video above, you'll see me adding textures to the terrain. I then use Terrain Toolkit to select for the different heights that each texture takes place in. You'll see I now have sandy beaches and grassy terrains!

Step 11: Refining Your Terrain

We're going to refine the terrain now. The thing is, your terrain after texturing might still not look quite right. Mine had a lot of cliff rock going down to where the waterline will be. So I spent some time using the smoothing tool and re-applying the texturing to get things to look nicer. Have a look at what I did, and try to follow along. I'm sure you'll do great.

You'll see I now have somewhere for me to put water. I personally think water is a great way to help a scene feel infinite, as the water spans to the horizon, and makes the user feel like they're really on an island. Speaking of which... the next step is water!

Step 12: Water, Water, Water

I found some free low-poly water on the Asset Store. You can either find your own, or if you're really advanced, make it. But that's not for this tutorial, so I just went with my lazy route and found some, for free. Now you'll see that my island has water around it!

You'll notice that some areas did well with the water. Others.. not so much. So we're going to take some time during this step to refine the texturing in Terrain Toolkit, and to use the Terrain tools to smooth things out to help it along.

Step 13: (Optional) Tidal Erosion

We can also use the Tidal Erosion tool in Terrain Toolkit to help us out. Here, I've simply set the tool such that the blue line (water) is at my water plane. You can adjust the range to reflect how high the tide might go. Furthermore, you can pick some presets for different types of tides, but I left mine empty. Hit apply, and grab another coffee!

I've also played around a little with my texture slopes and onset values from earlier, as well as using the smoothing tool to iron out some rough details. Looking much better, right?

Step 14: Let's Talk About Skies

We're going to mess around with the sky now. I've changed out the stock Unity Sky for a much more interesting Toon sky I found on the asset store. You will want to find your own one as well. Now, you'll notice that the terrain lighting doesn't really match the sky we applied. We can fix that too. I want a moody sunrise feeling, so we're going to generate our first lighting data together. Special moments, huh?

Step 15: Lighting and Static Objects

We're going to quickly generate some lighting to show you how the sky affects lighting. My editor actually crashed at this step, so this is my friendly reminder to you to save your work! Go to File > Save and save the Scene as well as the project. You never know when that crash will come.

In the video above you'll see me start to bake the lighting. Its progress is displayed in the lower left. It will take a moment depending on how large your terrain is. Remember, that for lighting to work, you must set the object to static. Terrains are static by default, but in case you changed it on accident, see the screenshot for help. Look at the top left of the Inspector for any object, and make sure it's static. Static objects in the engine are objects that never move, so we can compute much nicer lighting for them than others. Make sure your Directional Light, I named mine "Sun" is also static.

These bakes take a while, treat yourself to another coffee :) The last screenshot is what the scene looks like now with the Lighting baked. Much nicer, right??

Step 16: Technical Information About Lighting

You may be wondering about Lighting and why we bake it. You can skip this slide if you don't care :)

When Unity creates shadows and computes how light moves around objects in real time, it often sacrifices high detail for performance. After all, the nicest shadows suck if we're playing your game at 10 frames per second. As a result, when we compute lighting in advance, we mark some objects that never move as Static. This tells the engine that we can safely compute their shadows and light properties as they will never change. In the screenshot above, you can see how the shadows are unusually placed until they're baked.

This isn't to say that you can't have moving objects, but the more of them we can pre-bake, the better your performance in game!

Step 17: Fog Is Your Friend

In real life, fog sucks. But in game design, it makes for an excellent way of reducing the players visual field, and making things seem much more distant than they are. To do this, navigate to the Lighting tab and select Fog. Play around with the values to create a realistic fog for your scene. See my video above to get an idea of what it might look like when done relatively properly.

I've also tweaked the sun colors to make a more sunset-y feeling. You will want to take your artistic liberties here to create the mood you want. Also note that I used the color of the horizon of my sky for my fog. I love this technique, as it allows for an excellent blend of color in the game!

Furthermore, I went into my water properties and I changed up the color and foam schemes for the water, to make it more gentle and to blend better with my horizon colors. Remember, nothing is permanent, and we can change these things later if they're not satisfactory :)

Step 18: Mother Nature Calls

It's time for the moment you've all been waiting for. Let's add some vegetation! For the first pass, we will focus on large trees and vegetation, which we will place sparsely through the map. Select your terrain, and pick some trees you like. Navigate to the tree tab of the Terrain Inspector and select the trees you want. Then adjust your brush size and density to paint some trees around. Remember, we want sparse tree placement for these first trees. It's easy to quickly overdo it and get too many things going on at once!

In this case, I've chosen to respect the contour lines of my terrain and only place these large trees on the greenest areas of the island. This gives the user a feeling of natural continuity, and a pattern. For the next step, we will place some trees on the other areas to create a dispersing feeling.

Step 19: More Trees, But Also Grass

We want less dense tree placement now, in the rest of the terrain, and leaving some areas with no trees at all. This gives the user a sense of relief when they exit a wooded area, and into an open clearing. We also want to get some grass down. Note that I've left a large section of the terrain with nothing in it. We're going to put a high-detail object there. This could be something like a village, or an abandoned castle. Something huge and attention grabbing. This turns the forest around it into scenery, and makes this object the main interest of the user.

Step 20: Adding Loose Details

Here, we want to make the island feel real. To do that, I've added some random rocks, outcroppings of temples and buildings, and added ships in the water. See my videos to get an idea of what I'm doing here. Basically, imagine the eye is thirsty. These details are water! We want the eye to never be too shy of a detail that isn't ordinary, like trees and ground. This continuously draws the users attention to the various features of our map, and keeps them entertained!

Don't worry if your details feel forced at first, just watch the videos again and keep on trying :)

Step 21: The Main Details

We want to make a central component to the island now, that unifies the surrounding periphery. In this case, I'm laying walls in a wide circle, to set the foundation for where a city will go. In this case, I punctuate the areas of the city with vegetation to avoid repetition and boring the player. With about half this area done, I want to turn your attention to one last detail that really helps a map come together...

Step 22: Paths and Roads!

I've used the painting tool for the terrain to create paths that run from each area to some other areas. It create very random looking paths, that allow the user to explore toward any number of points in the map, while distracting them from the vast space which we filled with only trees. Take some time now to trace paths through your map for the user to take. You'll find it greatly enhances your experience in playing the map later!

Once you're satisfied with your paths, take the time to erase most of the vegetation on the paths, and remove the trees on the paths. The result from a birds eye view is very satisfying and feels map-like. Now that we've done all this, pat yourself on the back, the hard parts are done! Next, we're going to optimize the map for play and have a chance to walk around for a bit and explore it!

Step 23: Occlusion and Static Objects

Remember earlier, when we marked everything we used as static to compute light? We're going to do that now for the rest of the objects in the map. Then we're going to compute Dynamic Occlusion. In plain terms, we've put a LOT of stuff on this map. Most computers won't be able to handle the map... unless we do something a little sneaky. When we compute occlusion, we basically establish the visibility of each object on our map. The Engine will automatically hide the objects outside the player's view, and reduce the load on the target machine! It's super useful, as that means that the player only has to render what they're looking at!

To do this, select all the objects in your Hierarchy (prepare for lag), and mark them all as Static. Then, go to "Window" > "Occlusion Culling" to open the Occlusion Culling Window. Then navigate to the "Bake" tab, and select Bake. See the video for this step for help. You should soon see some blue cubes being drawn across the map. These are occlusion volumes! The objects inside each cube will only be visible if the user can see any part of that cube. Don't worry, our players won't actually see the giant ugly cubes in game! :)

Once Occlusion is computed, let's go to the next step. We're almost done, I promise!

Step 24: Post Processing Stack

Let's make our game even more beautiful! Download the "Post Processing Stack" from the Asset Store. Then, create a Camera in your scene if you don't already have one. Drag it around and point it at something that gives you a good idea of what a user might see.

If you're interesting in seeing Occlusion Culling in action, open up the Bake tab in Occlusion Culling with the Camera added, and you should see most of the scene disappear! This is good, as it shows what the engine would be rendering at this angle. Close out of Occlusion Culling to go back to normal. See the video attached on how to add a Camera and easily center it on your view!

Then, right click on your Project Browser (as shown in the Video), click "Create" and then "Post-Processing Profile". Click on the Camera, and click "Add Component", "Post Processing Behaviour". Drag the new Profile to the slot on the Camera's Post Processing Behaviour. Then, select the Post-Processing Behaviour and tweak some of the options to attain a more beautiful scene view!

Step 25: Compute Lighting... Again...

This last step will allow us to recompute the lighting one more time. This will encapsulate the new objects you've added and reduce the load of the system at runtime. Just like before, open the Lighting tab from "Window" > "Lighting", and then at the bottom right, click "Bake". This one will take way longer than the first one, and may even crash Unity, so be sure you've saved before you start! Click it, and go grab ten coffees and an IV bag to drip them into your bloodstream. You've got to be exhausted by now :)

If you're bored and want something to do, you can still work on the scene, but just don't move any objects. I took the time to finish off some trees and grass details and refine my paths further. Like I said, this step will take a while, so hang in there! If you see your console explode with errors, there's nothing to worry about, just ignore them. Trust me, they're no big deal.

Step 26: Final Considerations: Particles!

You can get some free Particle Effects on the Asset Store to spice things up! I went and found some magical ones and fire ones to help make the sky come alive in my scene! They add that extra bit of detail that really makes the whole thing feel real. Feel free to tinker in this step with particle effects, and then our final step will be to walk around and see it for real!

Step 27: Congrats!

Congratulation on finishing your first Unity Map Level! We're going to reward ourselves by walking around! To do this, go to "Assets" > "Import Assets" > "Character". Then, when it's done, drag a FPS Controller out of "Standard Assets" > "Characters" > "First Person Character" > "Prefabs" from the Project Explorer at the bottom. Drag this guy wherever you want to be standing. Then, find the camera we created earlier, and drag the Post-Processing Behaviour from it to the new camera on the FPS Character. Then, delete that old camera. Finally, hit the Play button at the top middle of the screen. You can walk around using WASD, and use the Space Bar to jump. Have a fun time walking around and exploring your hard work!

When you feel satisfied, press Escape to bring back the cursor, and click the Play button again to exit play mode. Call up your ten closest friends and bore them to death with details of how you just designed your first map! Congratulations :) If you've made it this far, you've got it in you to go even further!

Game Life Contest

This is an entry in the
Game Life Contest

Share

    Recommendations

    • Water Contest

      Water Contest
    • Fix It! Contest

      Fix It! Contest
    • Metalworking Contest

      Metalworking Contest

    18 Discussions

    This instructable is awesome! I literally heard about Unity3D a week ago. Thank you for this tutorial! (PS) Hope you win!

    1 reply

    Unity is amazing since it has such an easy entry point and a forgiving learning curve! Thanks for the wishes, I hope I win too :)

    Yes, I created a game called CityScape with my girlfriend about 6 months ago. It’s on iOS and Android appstores :)

    I never knew how to use Unity. But now I know. Thanks for good tutorial.

    5 replies

    Feel free to reach out at any time while doing this if you have questions, or if I missed something.

    Please can you make a tutorial about making a player and some moving objects in Unity? I found some but I never used C# and I don't understand those tutorials. Thank you!

    At the end of this tutorial, I indicated how to load Unity's First Person Character to walk around. Did you want a tutorial on how to make your own?

    Yes please, I want to make my own and how to code it. I am simply C# and Unity beginner so I would like to learn more. Thank you!

    Sure thing! I will create a tutorial for you, just give me a few days time. I’m glad you’re an aspiring Unity developer!

    0
    None
    _heck_

    4 weeks ago

    A note to everyone reading this Instructable: Instructables Support Team has notified me that they are aware of an issue with MP4s being inaccessible, and are working their hardest to resolve it. I will keep you posted as we move forward. In the meantime, thank you for your patience :)

    wETHtIV.png

    Very nicely done! Btw,are you aware that your videos are inaccessible?

    2 replies

    Thank you for the feedback, and I just realized this now! When I posted the tutorial, the files had different names than they do now, and you're correct, they're totally inaccessible.. I will open a ticket with support to figure this out.

    Thank you so much for bringing this to my attention!

    Thank you for the feedback, this was my first tutorial, so I'm glad a seasoned user like yourself found it appealing!