Coding For Wall Removal
D038 #PanicRoom
I do not have a lot to show for what I’ve been working on, as it is mostly code-based, but the work has definitely been going in. I spent several hours figuring out how to tackle removing the pieces of exterior walls at the ends of the hallways and just coming up with a way to approach how I would do it.
At first, it seemed like a monumental challenge, but I approached it logically and laid out my intent before ever considering how it would be implemented. I think tackling it in this manner actually made it easier to solve: I outlined what I wanted to have happen, then went back and worked on one small bit at a time, with lots of testing with each little baby step. Before I knew it, I had something to show that was working the way I wanted it to!
The hardest part was figuring out how to be able to Destroy a GameObject without getting a vital asset warning. This was because my first attempt to simply remove the instantiated wall tiles was merely me trying to directly delete a prefab, which doesn’t fly in Unity. In order to do this properly I had to set up a reference to a prefab clone and remove that instead. It sounds complicated, and honestly, it kind of was for a few minutes, but some careful research led me down the correct path where I discovered how I should actually be setting this up. In my case it was as easy as setting up a new 2-dimensional array, corresponding to my grid layout system, and instantiating my wall pieces into that array for later manipulation. It worked beautifully and gave me the results I wanted!
R2D08 #100DaysOfCode
R2D03 #100DaysOfGameDev