Color Maze – Level Creator

Since creating Levels everytime from scratch can take rather long for a “one man army” like me, i decided to create a Level Creator for Color Maze. Actually it provides me with some random maps, which already have floor tiles, walls, goals and and players according to my setups.

Also “Editor Scripting” makes my live more easy in setting up basic setups at all.

So i can determine Playfield Size, Player Amount and even the look of the levels, if i for example later want another design i can change the used Prefabs as well.

Not always perfect, but just a single click, to get some ideas for new Levels.

If i like a setup, i “just” need to add Buttons, Doors, Elevators and test the Level. Completely automating Level creation including all riddles as well, would take way more time, since i’d have to write a complete different creator, which already needs to check if a Level would be beatable.

When it comes to editor scripting i just use some simple lines of code,to call my functions to create my levels inside the editor. To remember that maybe for later projects i will copy some code here.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEditor;
 
 [CustomEditor(typeof(LevelCreator))]
 [CanEditMultipleObjects]
 public class LevelBuilder : Editor {
 
     public override void OnInspectorGUI()
     {
         LevelCreator myScript = (LevelCreator)target;
 
         EditorGUILayout.BeginHorizontal();
 
         EditorGUI.BeginChangeCheck();
 
         if (GUILayout.Button("Create Level"))
         {
             myScript.CreateLevel();
         }
 
         if (GUILayout.Button("Clear All"))
         {
             myScript.ClearLevel();
         }
         EditorGUILayout.EndHorizontal();
 
         EditorGUI.EndChangeCheck();
         EditorUtility.SetDirty(target);
         DrawDefaultInspector();
     }
 }

So this creates 2 Buttons seen in the top, and calls the functions in my LevelCreator Script.

Subscribe to Newsletter

By subscribing you agree to receive promotional material like info's about new Unity Courses, Coupon Codes, Special Offers and more...

We keep your data private and share your data only with third parties that make this service possible. Read our Privacy Policy.
You can unsubscribe anytime.