Making A 3D Maze Game in Unity - 10/10

Now we are going to make some dead zone. If the player touches the dead zone the game will be over. Our dead zone will be similar to our goal point. we will detect if the player is in a dead zone with a trigger collider.

Whe the player is in a dead zone, we will enable gameover activity. When game is over, we will set the gameOver bool true. gameOver variable is in menu manager and it is a static variable. manager script will enable the gameover panel after then.

I am using cube for the dead zone. You can use your own model to get a nice shape of your. But make sure there is a collider component and the isTrigger box is checked.


Make a new material for your dead zone and apply it.

Make a new c# script and name it deadZone. Attach this script with the collider. now open it in the mono develop and copy paste this script.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class deadZone : MonoBehaviour {

// Use this for initialization
void Start () {

// Update is called once per frame
void Update () {

void OnTriggerEnter(Collider col)
            manager.gameOver = true;



Now save it and go to unity. Make a prefab so that you can use it any where in the scene. Now set in the game scene as we set collecta. When the player touches the dead zone, the game will be over. It should work fine.

You can make more scene like this with different maze. The scenes will be your levels.

Now go to build settings from

File>Build Setting

Add all of your scene on scenes in build. For now we have two scene.

-main menu

-game scene

I keep the menu scene in the first position because when we will open the game, we need to land on menu first. You can change your icon or other things from player settings. for now I just put them as default. hit the build button. Select the folder you want to save

By default yor platform should be

Pc, Mac, Linux, Standalone

Now build the game by hitting the build button.



Boostlog is an online community for developers
who want to share ideas and grow each other.

Delete an article

Deleted articles are gone forever. Are you sure?