- Home /
Change the mesh of a gameObject
That seems to be a dull question, but it isn't obvious to me.
I was making a model in Blender while my friend was coding, so we worked together. He has attached multiple scripts to our Main Character, which is just a cylinder. Now that we have the model ready, we want to replace the cylinder with our model.
How is this possible?
Answer by AlucardJay · Apr 06, 2013 at 04:51 PM
Not at all, I can respect this question.
Most of the time, you should use an empty gameObject, have your scripts and collider on this empty gameObject, and then have your graphics as a child of the gameObject.
For your purpose, you can simply disable the capsule renderer (or remove the renderer component), and then drag your model in and make it a child of the capsule, so everywhere the parent goes then so does the child (model).
Just be aware that you should leave the scale of the capsule to 1, it will do funny things to your model if you change the scale of the parent.
Adjust the variables on the collider component (center, radius, height) and watch the green wireframe in the scene view until it encapsulates the model.
Edit : I forgot to mention I made a video that demonstrates this : http://www.youtube.com/watch?v=9hbjTOanljA&t=7m38s
Your answer
![](https://koobas.hobune.stream/wayback/20220613095817im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Replace GameObject with different FBX 0 Answers
Replace a child gameobject by an other at runtime 1 Answer
using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers
How to replace the old "Awake"? 1 Answer
Want replace a current object with one inside array the object being replaced with is prefab 1 Answer