Signup/Sign In

Developing Maze Game Components in Unity - Part 1

In this tutorial, we will discuss step by step, how to proceed with the development of some components of the game. These components of the game and the logic associated with each one of them is important to understand. We will start with moving a simple game component which will be our player or the lead object for this game. Yes, I'm talking about the ball, the ball which has to cross the maze. Come on, buckle up!


Start developing Game Components in Unity

Follow the steps mentioned below to develop a simple game component. Our game component will be a ball, and we will learn about its various properties where we will add color, adjust its size and then later move the ball using the cursor keys of our keyboard.

Some quick points to remember,

  1. Open Unity 3D (4.5 or above version).
  2. Check all the menu option once, just to become friendly with them.
  3. You can save the scene of your project by going to File → Save Scene and give it a name and appropriate location.

Now let's start working on Game components

  1. Go to File → New Project.
  2. Give your project a name, we think Ball-Motion is a nice name and set the path where your project will reside.
  3. Go to GameObject Menu → 3D object → Plane. You can also get that from the hierarchy view using Create menu.
  4. From the hierarchy window pane, you can give your Plane a new name - example ground.
  5. You can reset and transform components from the Gear menu under Inspector Pane and click Reset option. This will place the game object at the position 0, 0, 0 which is also the origin of your game world.
  6. Now if you want to change the scale of your plane, you can do it in multiple ways. You can directly select the scale tool from the toolbox, then grab the axis handle and use your mouse to change(move) it. You can also select any one of the three colored (red/ green/ blue) axis for changing the size of the object. You can do this for any object.
  7. Now in our ball game, our ball (game object) will act like the player. To bring this ball into picture, Go to GameObject → 3D object → Sphere.
  8. You can resize it by selecting scale tool and then dragging its three dimensional axis or from the inspector pane, just change the scale.
  9. Now drag the ball upwards so that it just touches your pre-existing plane/ground which you have already created. Doing this will move your ball over the plane after the movement related C# coding is done.

    Developing Game Components with Unity 3D - Ball Game


  10. By default there will be light and camera positioned in your Unity Scene.

    Developing Game Components with Unity 3D - Ball Game


  11. To add color or texture to your game objects (here plane and sphere), you have to use materials. So to keep the materials create a new folder in your project. Go to Project pane and select Create menu and then Folder. Rename it as Materials. Again go to, Create → Material → and give it a name....

    Developing Game Components with Unity 3D - Ball Game

  12. Just like in the above figure, you can create materials, the select that material, click on Albedo (which holds the whole range of colors) and choose any color and give each of your game objects a different color. To associate that color to your game object, you have to drag that material onto the game object.
  13. You can change the color of the material whenever required.

In the next tutorial we will learn how to move the ball and pass it through some randomly placed cubes, which will later form the maze. All these things will be designed and coded, and you will have lots of fun during this basic game component development tutorial.