Editor Window : Enable / Disable MeshRenderer
EnableDisableMeshRenderer is a powerful tool that helps me disable/enable all blocking colliders in the game with one click, in contrast, facing some bugs of not having restricted colliders at some places while working on a driving simulation project. So these objects have their MeshRenderer disabled in the scene. So to figure out the missing one at a faster pace, instead of driving the whole map (because it was too big), I enabled all mesh and looked for the missing once. So there was a big hierarchy of parents and its child in the Road Colliders section. So I used this to enable and disable them all in ONE click.
How to use the script?
When you click the enable/disable mesh renderer button. It will look for the selected object and perform the enable/ disable task respectively on its childs & event it child objects till they exist.
How does the program work?
First, it gets the current selected game object, using Selection.activeGameObject. Then get all the MeshRenderer components present in the child object and store them into an array. Then using the help of a foreach loop set the value as true/false as required.




Comments