- Home /
Loop through Hierarchy meshes and add colliders
I have a big model I exported from SketchUp and I need to add mesh colliders to each mesh in it. Doing that manually is a ton of work (that I did once), is there a way to do it with javascript? The workflow I thought is loop through game objects and groups (the model is named BeachHouse) and then search for meshes inside those and add the component Mesh Collider, that's what I did manually but now I need it automatic for future models, is it possible?
Answer by IvovdMarel · Jul 07, 2014 at 12:13 AM
Use a foreach loop through this.getcomponentsInChildren().
If you'd like to do this permanent, make sure your scripts executes in edit-mode
Your answer
Follow this Question
Related Questions
moving hole 3 Answers
Pushing a mesh with mesh collider 1 Answer
list.Add() not working 3 Answers
Mesh Collider Issue(?) - Raycast (ScreenPointToRay) Appears to Collide on Nothing 0 Answers
Changing Meshes but end up in the air when testing 0 Answers