make part of a object invisible and visible

Hi

I have one objects that made up of several model groups in maya. I want to put it in an array, I also want to show parts of it and hide parts of it. I wonder if anyone know how to do that?

Thanks a lot!

I don’t how those model groups are being imported by Unity, there are two chances:

  1. One gameObject only with a mesh (that has submeshes)
  2. A gameObject with several childs. Each one of them has a mesh that is a part of your entire model.

If you are in the second case, you need only to disable the renderer of the desire part of the model. Can you see each submesh as a child of the object that represents the file to import in the Project panel?

Hi Thank you! I think it is the second situation.

Sorry ,
I think it is the first situation that with submeshes.

Using a custom script you could render the mesh in pieces.

var Visual : Mesh;

function Update()
{
	Graphics.DrawMesh(Visual, transform.position, transform.rotation, null, 0);
}
static function DrawMesh (mesh : Mesh, position : Vector3, rotation : Quaternion, material : Material, layer : int, camera : Camera = null, submeshIndex : int = 0, properties : MaterialPropertyBlock = null) : void

By specifying the submesh index you could render a specific part. Don’t forget that you have to set the material manualy.