Created
May 5, 2022 07:18
-
-
Save danielbierwirth-unity/4c3e82e66a70d5de7f4fc01623669dce to your computer and use it in GitHub Desktop.
Create small menu entry to disable all mesh renderers attached to a GO - use this for collision meshes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [MenuItem("MyTools/DisableMeshRenderer")] | |
| static void ApplyToSelected() | |
| { | |
| Debug.Log("Apply to selected"); | |
| GameObject[] selectedObjects = Selection.gameObjects; | |
| foreach (GameObject obj in selectedObjects) | |
| { | |
| if (obj.GetComponent<MeshRenderer>() != null) { | |
| obj.GetComponent<MeshRenderer>().enabled = false; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment