Escape from the maze


You can down­load the source code of this project in the card from below. You don't have to pay for it but if you want to sup­port this project and new upcom­ing projects you can pay the sug­gest­ed price or name your own price. If this prod­uct receives sup­port I will update with more mechan­ics like mul­ti­ple lev­els and a lev­el selector.


A char­ac­ter is trapped inside the maze in which there is only one door to escape. The exit is blocked and to open it you have to find the key, which will appear when you have found a set of objects.

How to play

Move with the WASD keys or the arrow keys and ori­ent the cam­era with the mouse. Pass over the objects to pick them up.

Developed by:



About the development of this game

The game Escape from the Maze is a first per­son game made in Uni­ty and con­sists of find­ing a series of objects before time runs out. This pro­to­type was a com­mis­sioned work.

Ini­tial­ly the project was much sim­pler than what you can see in the pro­to­type below, since it was a work with clear instruc­tions that empha­sized the log­ic and mechan­ics of the game rather than the graph­i­cal aspect. After deliv­er­ing the work I con­tin­ued doing light­ing and post-pro­cess­ing exper­i­ments, I added a 3D mod­el of a per­son with ani­ma­tions from Mix­amo so that shad­ows of the play­er are pro­ject­ed on the walls of the maze. The project is not opti­mized for the WebGL ver­sion so it is like­ly to run very slow in full screen.

Technical Details

Next we are going to review some infor­ma­tion about the inner work­ings of this game, first of all it is a 3D project devel­oped with the Uni­ty engine.

The 3D mod­els of the scenery are mod­els that I made using Blender and the tex­tures with Sub­stance Painter, this process took about an hour approx­i­mate­ly because I already knew exact­ly what I had to do and I had even done it before.

Giv­en the sim­plic­i­ty of the pro­to­type I used a sin­gle Uni­ty scene, so there was no need to wor­ry about trans­fer­ring infor­ma­tion between scenes.

All the GUI ele­ments of the main menu are chil­dren of a GameOb­ject that is inside a Can­vas, the GUI dur­ing the game­play is also built that way, so when start­ing the game what is done is to deac­ti­vate the GameOb­ject that con­tains the GUI ele­ments and acti­vate the GameOb­ject that con­tains the game's GUI.

Game mechanics

Player-controlled character

The play­er con­trols the char­ac­ter using the direc­tion­al arrows or the WASD keys, the cam­era is con­trolled with the mouse. I don't remem­ber well but it may be the pre­fab­ri­cat­ed "First Per­son Con­troller" from Stan­dard Assets.

Objects to find in the labyrinth

The six objects to be found appear in the maze ran­dom­ly and at a cer­tain dis­tance from each oth­er. To achieve this, an instan­ti­a­tion sys­tem was cre­at­ed that takes into account the shape of the parts of the maze and the regions where the objects could appear.

The objects emit a sound whose inten­si­ty depends on the player's dis­tance, the clos­er the play­er is to the object the loud­er the sound will be heard, this is a clue to locate them.

In order to detect that the play­er picks up the objects, Col­lid­ers and the OnTrig­ger­Enter event are used, when pick­ing up an object, it is checked if all the objects have been picked up, if this is true, the key is released.

The key to unlock the exit

The key is like a sev­enth object that is instan­ti­at­ed using the same sys­tem as the pre­vi­ous objects, the dif­fer­ence is that doing so we imme­di­ate­ly deac­ti­vate the GameOb­ject of the key so that it dis­ap­pears from the stage, when the play­er finds all the objects the GameOb­ject of the key appears and a sign in the graph­i­cal inter­face indi­cat­ing that you have to find the key.

The door to escape from the maze

The door is a 3D mod­el divid­ed into two parts so that it can be opened, and there is a Col­lid­er just ahead to check if the play­er is in front of it.

If the play­er enters the region in front of the door we check if he has picked up the key, if not the action is inef­fec­tive, but if the play­er has the key the door opens with a rota­tion ani­ma­tion for each object in the door.

Scroll to Top
Secured By miniOrange