Streamlining Code
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2020/06/panic_button_press.gif?resize=147%2C109&ssl=1)
D039 #PanicRoom
R2D004 #100DaysOfGameDev
R2D009 #100DaysOfCode
While I figured out how to Destroy or Move the walls at the end of my Primary Hallway, I wasn’t too pleased with the overall bulk of the code I used to achieve it. Looking at it a little more closely, I determined I would be better off designating a new Function that could be used repeatedly to accomplish tasks. This led me to set up my MoveWall function which drastically reduced the number of lines of code I originally had in my script to accomplish the same results.
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2020/06/2020-06-16_devenv_script_HouseBuilder_request_wall_move.png?resize=733%2C274&ssl=1)
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2020/06/2020-06-16_devenv_script_HouseBuilder_MoveWall.png?resize=785%2C308&ssl=1)
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2020/06/2020-06-16_Unity_moving_vertical_primary_walls.png?resize=746%2C460&ssl=1)