#1 Starting the project

Updated information about this project

This arti­cle belongs to a series that con­sist on mak­ing a first per­son game about find­ing objects inside a maze. It's one of my very first series from the chan­nel. Now I reworked this project and you can down­load it to import in your own Uni­ty project. Some day I will make a new series about this project, sub­scribe to my chan­nel to see all the fresh con­tent about Blender, Uni­ty and pro­gram­ming.

Follow me on itch.io and download the source code of this project



Introduction of the old article

This is the begin­ning of the Labyrinth series, in which we'll cre­ate a sim­ple pro­to­type of a first-per­son game in which the stage will be a labyrinth, while we see all the tools that Uni­ty has to cre­ate games.

This series is ide­al for those who do not have expe­ri­ence with Uni­ty as it shows a lit­tle of every­thing and with­out going into detail, the pur­pose is rather to observe the entire devel­op­ment process to get a gen­er­al idea.

Go to the project's Main Page

Video related to this article

Before we begin, I invite you to watch this video from the My First Game series at Unity.

Creation of the project

When you run Uni­ty or Uni­ty HUB, a win­dow appears in which you can cre­ate new projects, open them and access the tutorials. 

We will cre­ate a new 3D project, give it a name and choose a loca­tion on the disk. Every­thing else is option­al. When every­thing is ready we cre­ate the project

We give it a name and select the 3D template. 

Ventana de inicio de Unity. Crear o cargar un proyecto.
Fig. 1: Uni­ty start­up win­dow. Cre­ate or load a project.

The first thing we're going to do is cre­ate a new scene. In this ver­sion of Uni­ty, by default we cre­ate the scene "SampleScene.unity", as seen in the head­er of the pro­gram in Fig­ure 2. 

To cre­ate a new scene click on File > Save Scene As…

Menu file de unity3d
Fig. 2: To save a new scene go to File > Save Scene As…

We give it a name and keep it. When you do it, you can see in the head­er the name of the new scene.

unity 3d ventana emergente para guardar una escena.
Fig. 3 Pop-up win­dow to save the scene.

Each scene has its own design inde­pen­dent of the oth­ers. For exam­ple we can use one scene for the main menu and anoth­er for the game. 

It's all going to depend on how we want to struc­ture the game.

Creating folders

It's impor­tant to set up an orga­ni­za­tion sys­tem for our Uni­ty game files from the begin­ning, because as we go along we're cre­at­ing more Scripts, import­ing more files and things get clut­tered easily.

All project files are locat­ed in the "Project" win­dow, inside a fold­er called "Assets". This fold­er can be found in the direc­to­ry we defined for the project.

programa unity3d menu para crear una nueva carpeta. crear una nueva carpeta en unity.
Fig. 4: Cre­ate a new fold­er for the project. 

As can be seen in fig­ure 4, right-click­ing dis­plays a menu with dif­fer­ent options, go to the "Cre­ate" option and choose "Fold­er".

We cre­ate as many fold­ers as nec­es­sary to orga­nize our­selves, this part is personal.

Import Packages

To start mak­ing a game in Uni­ty is not nec­es­sary to cre­ate every­thing from scratch, we can use exist­ing libraries to start work­ing on an idea. Next we'll import Uni­ty Pack­ages from the Stan­dard Assets library and the Asset Store.

Standard Assets — Unity

In the ver­sion of Uni­ty that I had at the time of record­ing the video, you could import the Stan­dard Assets pack­ages, a library offered by Uni­ty that has dif­fer­ent pre­fab­ri­ca­tions, effects and scripts that are use­ful to start with.

Right-click­ing on the fold­er we have the option "Import Pack­age" where we can choose a pack­age that we have down­loaded using the option "Cus­tom Pack­age" or we can choose a pack­age from Stan­dard Assets. 

If you do not see all the pack­ages as shown in Fig­ure 5, you have the option to down­load them from the Asset Store, but you must have a Uni­ty account to do so. We'll talk about that later.

programa unity3d menu para importar paquetes de la libreria standard assets.
Fig. 5: Import pack­ages from the Stan­dard Assets library.

In this case I will import from Stan­dard Assets the pack­ages "Char­ac­ters", "Par­ti­cleSys­tems" and "Util­i­ty".

With the pack­age "Char­ac­ters" we will be able to place in the stage a pre­fab­ri­cat­ed one that has imple­ment­ed a con­trol in first person.

Par­ti­cleSys­tems brings some inter­est­ing effects to use, such as fire and smoke.

Util­i­ty brings some use­ful scripts like a frames per sec­ond (fps) counter.

Asset Store — Unity

Unity's store con­tains an infin­i­ty of Assets, some of them paid and oth­ers free.

To access the shop we use the Uni­ty Asset Store tab, if it is not open, go to Win­dows > Asset Store or use the direct access Ctrl+9. As shown in fig­ure 6.

programa unity3d, ventana windows, está seleccionada la opción asset store.
Fig. 6: Open the Assets shop from the Window.

To use the store we must log into our account (we can do it from Uni­ty). Then using the home screen or the search bar we can explore the content.

In order to see how Asset Store is used we are going to down­load two pack­ages. The first is called "Sky­Box" and the sec­ond "Fast­Mo­bile­Bloom", we use the search bar to find them, in fig­ures 7 and 8 you can see the minia­tures of the packages.

miniatura del paquete skybox de la tienda asset store de unity3d. se observa un cielo de atardecer.
Fig. 7: Sky­box pack­age from the assets store.

miniatura del paquete fastmobilebloom de la tienda asset store de unity3d. se observa una ventana y un cartel de neón azul que dice hotel.
Fig. 8: Fast­Mo­bile­Bloom pack­age from the assets store.

To add them to our project we enter the pack­age and put "Down­load", at the end of the down­load we have the option "Import".

unity3d proceso de descarga de la tienda asset store.
Fig. 9: When enter­ing a pack­age we can down­load and import it, read com­ments and more.

Project hierarchy

With­in each scene all the ele­ments of the game will be defined, that is to say a sce­nario, objects that are part of the world, invis­i­ble objects that serve for the log­ic of the game, graph­i­cal inter­face, etc. All these ele­ments are known as GameOb­jects and will be list­ed in the hier­ar­chy of our project. 

As you can see in fig­ure 10, when cre­at­ing a new scene, we have two GameOb­jects that come by default. A cam­era and a direc­tion­al light.

unity 3d jerarquía de una escena. dos gameobjects.
Fig. 10: Project hier­ar­chy. By default we have a cam­era and a direc­tion­al light.

Let's delete the cam­era and start adding objects to the scenario.

By right click­ing on the hier­ar­chy we have the option to add dif­fer­ent GameOb­jects, e.g. emp­ty objects, prim­i­tives, lights, etc.

unity 3d jerarquía de una escena. creacion de primitivas. creacion de nuevos gameobjects.
Fig. 11: Right-click on the hier­ar­chy to cre­ate new objects.

I'm going to set up a sim­ple stage with a floor plan and some buck­ets and cylinders.

programa unity 3d se observa una escena con un plano.
Fig. 12: Plan cre­at­ed from the hierarchy. 

As we add more objects to the sce­nario the hier­ar­chy grows. It's also rec­om­mend­ed to have a good orga­ni­za­tion from the begin­ning, plac­ing appro­pri­ate names and using Emp­ty GameOb­jects to group the objects.

programa unity3d se observa una escena con un plano, un cubo y dos cilindros.
Fig. 13: Adding objects to the world.

Note fig­ures 14 and 15. In the first one you can see that both cylin­ders are con­tained by the cube, as they are slight­ly to the right and the cube has an arrow to unfold and col­lapse the con­tents. In fig­ure 15, on the oth­er hand, it is observed that they are at the same lev­el, so to speak.

unity 3d jerarquía de una escena. relacion de parentesco entre los gameobjects.
Fig. 14: The cube is the father of the cylinders.

unity 3d jerarquía de una escena. relacion de parentesco entre los gameobjects.
Fig. 15: The hub and cylin­ders are on the same hier­ar­chi­cal level. 

This rep­re­sents the kin­ship that exists between GameOb­jects. In fig­ure 14 it is said that the cube is the father GameOb­ject and both cylin­ders are chil­dren. This implies that the cylin­ders are going to be affect­ed by cer­tain changes that apply to the par­ent. For exam­ple if we deac­ti­vate the cube, both cylin­ders will also be deactivated. 

The same applies to the trans­for­ma­tion com­po­nent, for exam­ple. The posi­tion of the cylin­ders is mea­sured with respect to their par­ent, so if we move the par­ent, the cylin­ders move together.


To apply col­ors and tex­tures on the objects of the world the mate­ri­als are used. Let's cre­ate some to see how they work. Right click on a project fold­er then Cre­ate > Mate­r­i­al, as shown in fig­ure 16.

programa unity 3d, proceso de creacion de nuevos materiales. shaders.
Fig. 16: Mate­ri­als cre­ation process.

The mate­r­i­al is visu­al­ized as a sphere in which are applied the prop­er­ties of the mate­r­i­al we must assign it a name, as always main­tain the order from the first moment ben­e­fits us in the long term.

programa unity 3d, iconos de materiales.
Fig. 17: Dis­play of the mate­ri­als in the project window.

The mate­ri­als have sev­er­al para­me­ters that define it, in our case we will sim­ply mod­i­fy the col­or by click­ing on the box to the right of "Albe­do". When doing so, a col­or palette appears where we can choose the col­or or write its hexa­dec­i­mal code.

programa unity 3d, visualizacion de las propiedades de un material en el inspector.
Fig. 18: Dis­play of mate­r­i­al prop­er­ties in the inspector.

To apply a mate­r­i­al we sim­ply drag it over the desired object.

programa unity3d se observa una escena con un plano, un cubo y dos cilindros. El plano está pintado de marrón.
Fig. 19: A mate­r­i­al has been applied to the plane.


Let's select the direc­tion­al light from the hier­ar­chy or in the scene window.

programa unity3d se observa una escena con un plano, un cubo y dos cilindros. El plano está pintado color marrón, hay dos cilindros azules, uno rojo y un cubo rojo, Además una fuente de luz direccional.
Fig. 20: Mate­ri­als have been applied to all objects in the scene.

Direc­tion­al light is a source of light such as the sun, i.e. sit­u­at­ed in infin­i­ty and send­ing all its par­al­lel rays. For this rea­son mov­ing the source or mak­ing it larg­er does not affect the illu­mi­na­tion of the scene, but chang­ing the rota­tion if it does. We see it in the direc­tion of the shadows.

programa unity3d se observa una escena con un plano, un cubo y dos cilindros. El plano está pintado color marrón, hay dos cilindros azules, uno rojo y un cubo rojo, Además una fuente de luz direccional.
Fig. 21: Rota­tion of the direc­tion­al light, the shad­ows are pro­ject­ed in anoth­er direc­tion if we com­pare with fig­ure 20.

Create a ladder with primitives

Let's do this lit­tle exer­cise to see the ele­ments of Unity's tool­bar, par­tic­u­lar­ly the tools that will allow us to mod­i­fy the Trans­form com­po­nent of GameOb­jects. We start­ed by cre­at­ing a cube in the hierarchy.

programa unity3d barra de herramientas.
Fig. 22: Unity's basic toolbar.

The tools move, rotate and scale are shown in fig­ure 22 in posi­tions 2, 3 and 4 respec­tive­ly and are quick­ly accessed using the "W", "E" and "R" keys (respec­tive­ly).

If we press the R key with the cube select­ed, we can scale it using the "Giz­mo" of the three axes, as shown in fig­ure 23.

programa unity3d, escalar un cubo en una direccion.
Fig. 23: Scal­ing a GameOb­ject in one direction.

We scale it in two direc­tions to give it the appear­ance of a step.

programa unity3d, escalar un cubo en una direccion.

Fig. 24: Scal­ing a GameOb­ject in one direction. 

We apply a mate­r­i­al to it and with the W key we can place the step on the stage.

programa unity3d, escalar un cubo en una direccion y moverlo en la escena.
Fig. 25: Posi­tion­ing of the object in the scene.

We can eas­i­ly dupli­cate the object using the short­cut CTRL+D and with the W key raise it a lit­tle and move it backwards.

programa unity3d, duplicar un gameobject y desplazarlo.
Fig. 26: Dupli­ca­tion of a GameObject. 

We can repeat this process with sev­er­al select­ed steps.

programa unity3d, duplicar un conjunto de gameobjects y desplazarlos.
Fig. 27: Dupli­ca­tion of a set of GameObjects.

Let's cre­ate an Emp­ty GameOb­ject and call it "Sce­nario".

unity 3d jerarquía de una escena. creación de empty gameobjects para organizar.
Fig. 28: Cre­at­ing an Emp­ty GameOb­ject to orga­nize elements.

unity 3d jerarquía de una escena. creación de empty gameobjects para organizar.
Fig. 29: The Emp­ty GameOb­ject is giv­en the name Scenario.

Then we select all the objects and drag them to this new object to group them. In this way we can col­lapse the whole con­tent and the hier­ar­chy is more order­ly, as shown in fig­ure 30.

unity 3d jerarquía de una escena. creación de empty gameobjects para organizar.
Fig. 30: All GameOb­jects on the stage are dragged into the Emp­ty GameOb­ject and the con­tent collapses.

First-Person Controller

The rea­son why we pre­vi­ous­ly removed the cam­era is because we are going to place the pre­fab­ri­cat­ed "FPSCon­troller" from Stan­dard Assets on the scene and it already has a built-in cam­era. This pre­fab is locat­ed in the direc­to­ry Stan­dard Assets > Char­ac­ters > First­Per­son­Char­ac­ter > Prefabs.

programa unity. prefabricado de un control primera persona.
Fig. 31: Pre­fab FPSCon­troller of the Stan­dard Assets Char­ac­ters package.

We take it to the scene and put it where we like.

programa unity3d. se observa una escena con suelo marrón, una escalera azul, dos cilindros rojos y dos cilindros azules.
Fig. 32: The FPSCon­troller pre­fab is placed in the scene.


We are already able to do some tests, in the top cen­ter we have three buttons. 

The Play but­ton is used to start run­ning the game. The sec­ond but­ton paus­es the game but does not end it. The third but­ton is used to advance a sin­gle frame in the game.

Press­ing the Play but­ton dis­plays an error sign say­ing that all errors must be fixed before you can enter game mode.

programa unity3d. se observa una escena con suelo marrón, una escalera azul, dos cilindros rojos y dos cilindros azules. En el centro un cartel que dice: "All compiler errors have to be fixed before you can enter playmode".
Fig. 33: When try­ing to enter game mode an error mes­sage appears.

This is a prob­lem that we are going to encounter very often, espe­cial­ly at the begin­ning and it is usu­al­ly very frus­trat­ing, even more so if we are learn­ing to program.

To get infor­ma­tion about what is hap­pen­ing we have the "Con­sole" win­dow. If it is not open, you can find it in the "Win­dow" menu.

programa unity3d, consola de unity mostrando advertencias en amarillo.
Fig. 34: Sev­er­al warn­ings with a yel­low sign are dis­played on the console.

In fig­ure 34 we see a large num­ber of warn­ings but this does not affect the oper­a­tion of the game, are sug­ges­tions for opti­miz­ing the code, warn­ings for use of obso­lete code and so on. If only we had warn­ings we could enter the game mode with­out problem.

Fig­ure 35 is a screen­shot after click­ing the "Clear" but­ton, this clears the warn­ings and lets you see the errors that can­not be over­looked in order to enter the game mode. These are shown with a Red sign.

programa unity3d, consola de unity mostrando errores en rojo.
Fig. 35: The con­sole dis­plays an error mes­sage with a red sign.

There is not much infor­ma­tion about the error but it is enough for us to under­stand that there is a file that is not found. If we look at the address we see that it is relat­ed to the Stan­dard Assets pack­age and we see that its address begins with "Assets > Stan­dard Assets > …". In the video we made a fold­er called "Exter­nal Pack­ages" and inside it we put the Stan­dard Assets package.

Every­thing seems to indi­cate that there is some process that is look­ing for Stan­dard Assets files but inside the Assets fold­er, not the Exter­nal Pack­ages fold­er, so I move the Stan­dard Assets fold­er to the Assets fold­er and the error is fixed. Now if we are able to enter the game mode.

programa unity3d, cambio de lugar de las carpetas del proyecto.
Fig. 36: The Stan­dard Assets pack­age is tak­en to the Assets fold­er of the project.

Testing the game at Unity

The pre­fab FPS Con­troller works like a stan­dard first-per­son game. Move for­ward, back­ward, side­ways with WASD keys or arrows. Jump with space bar, with Shift you can run. With the mouse you can con­trol the view and it has the sound of steps. It's a good start­ing point to start form­ing an idea.

programa unity3d, modo juego, prueba de una escena en la que se ve el suelo marrón, cielo celeste, una escalera azul, un cilindro azul y un cilindro rojo.
Fig. 37: After cor­rect­ing the errors, the game mode can be entered.

Build the project

Now we will gen­er­ate a stand­alone ver­sion of the project, ie a set of fold­ers and exe­cutable file that can run on our oper­at­ing sys­tem with­out hav­ing the Uni­ty engine open.

Go to the File tab and click on Build Set­tings to con­fig­ure the com­pi­la­tion parameters.

programa unity3d, ventana file con la opcion build settings seleccionada.
Fig. 38: To make a com­pi­la­tion click on File > Build Settings.

We get the win­dow illus­trat­ed in fig­ure 39, there we can select the tar­get platform.

If you look at the top is where the game scenes are list­ed. At that time we don't have any scenes added to the compilation.

programa unity3d, ventana build settings. no hay ninguna escena agregada a la compilación.
Fig. 39: Win­dow with com­pi­la­tion para­me­ters. No scenes have been added.

By click­ing on the Add Open Scenes but­ton we are going to add the scene we were work­ing on through­out the video. As you can see in fig­ure 40.

programa unity3d, ventana build settings. hay unaescena agregada a la compilación.
Fig. 40: Com­pi­la­tion win­dow. The scene in which we work has been added.

Now all that's left is to click on Build And Run and choose the fold­er where to place the gen­er­at­ed files. At the end of the com­pi­la­tion process the game runs and a win­dow appears in which we can select the res­o­lu­tion and qual­i­ty. Press the Play! but­ton and the game starts.

ejecución de una versión standalone de un proyecto en unity. ventana para seleccionar resolución y calidad.
Fig. 41: Game start win­dow. You can choose the res­o­lu­tion and quality.


In this arti­cle we saw the first steps in start­ing a game at Uni­ty. We put empha­sis on orga­ni­za­tion, which will ben­e­fit us in the long run in development.

We saw the scenes of Uni­ty, each scene is a world apart and con­tains a cer­tain amount of ele­ments or GameOb­jects that are list­ed in the hier­ar­chy of the project.

We import files from both the Stan­dard Assets library and the Asset Store. At the begin­ning the most impor­tant thing is to try to give form to the ideas that we have, for this the assets of the book­stores facil­i­tate the things to us.

We saw some­thing about the par­entship that exists between GameOb­jects and how changes applied to a par­ent object also impact their child objects.

We cre­ate mate­ri­als that give col­or and tex­ture to objects.

The direc­tion­al light source serves us to illu­mi­nate a scene as the sun would, the shad­ows will be pro­ject­ed accord­ing to the rota­tion that this light source has.

We made a sim­ple lad­der using the prim­i­tives that can be cre­at­ed with Uni­ty and apply­ing trans­for­ma­tions to them, that is to say changes of scale, rota­tion and position.

We place the Stan­dard Assets pre­fab­ri­cat­ed "FPSCon­troller" which is a first per­son con­trol. Quick­ly we already have a char­ac­ter that can go around the stage, run and jump.

In the process there were bugs that we had to fix in order to get into game mode. Debug­ging errors is a dif­fi­cult task when we start pro­gram­ming, but with prac­tice we make few­er mis­takes and it's eas­i­er to cor­rect them.

Final­ly we made an exe­cutable com­pi­la­tion from the oper­at­ing sys­tem. There are a lot of plat­forms to which we can export our game in Uni­ty. In prin­ci­ple we are going to export to Win­dows and Android.

Scroll to Top
Secured By miniOrange