Kodeco Forums

Procedural Generation Of Mazes With Unity

Create a procedurally generated maze from scratch with Unity!

This is a companion discussion topic for the original entry at https://www.raywenderlich.com/82-procedural-generation-of-mazes-with-unity

Hi - I’ve completed the first part of the Generating the Maze Mesh section (to generate a single textured quad - but the quad doesn’t appear. I’ve tried to check everything but can’t see what I’ve done wrong; I also looked at the Inspector for Procedural Maze object during play, but don’t know enough about Meshes to know what to look for. I’m particularly confused about what the Materials are doing - the script adds two Material components to the game object, but I can’t see which, if either, should be displayed.

Any suggestions gratefully received



You are correct that you should check for an object called “Procedural Maze” during Play, but you don’t look for that in the Inspector, look in the Hierarchy. The Inspector is the panel on the top right, while the Hierarchy is the panel on the top left; this shows a list of all the objects in the scene.

What you do next depends on if the object is there. If so, then you just can’t see it, and the camera is probably facing away. Note that polygons in 3D graphics can only be seen from one side, so possibly it is simply facing away. You can reverse the direction a triangle is facing by simply reversing the order of the 3 vertex indexes in the code.

If however the Procedural Maze object hasn’t been created, probably that code is never run, and so you should check that all the relevant scripts are being called.

Thanks @jhocking - I went on and applied the refactored FromData() and could see bits of the maze but not all. Then I realised I’d done the whole thing in SampleScene, rather than the Scene provided. So I prefabbed the Controller into Scene and it seems to be working so much better! Thanks for a great tutorial, I’m hoping to build on this for my project.

Glad you figured it out!

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!