Well i think it is not even possible to use more than one MeshRenderer on the same object, same for MeshFilter.
And i think i never see more than one mesh applied to a MeshFilter on any model of mine. If i have several meshes in one Model, it will be seperated into Parents. Then you can just hide the parents if you need to.
For example if you want to make an MMO and customize your model, you could include all kind of jackets into one model. If you then want to display only the "naked" version, just make the parent "naked" visible and everything else invisible (like "robe", "t-shirt", whatever) (just an example, there are probably better solutions).
If this doesn't help, maybe it would help to know what exactly you want to do.
EDIT:
You could use a function lide to to show only the mesh you enter in the "showExcept":
So in this case, only "mesh1" will be displayed, everything else will be invisible.
you could write several function (to activate only one mesh without deactivating the others, activate everything except one, etc).
// This script is made to be applied to an unique gameObject that has 3 different meshes called HLOD, MLOD and LLOD that will correspond with its different versions.
var distance1 = 5.0; //Jump from HLOD to MLOD
var distance2 = 10.0; //Jump from MLOD to LLOD
private var HLOD : Transform;
private var MLOD : Transform;
private var LLOD : Transform;
function Start() {
HLOD = transform.Find("HLOD");
MLOD = transform.Find("MLOD");
LLOD = transform.Find("LLOD");
}
function Update ()
{
//The camera should have applied "MainCamera" tag in order to correctly switch LODs
var campos = Camera.main.transform.position;
if ((transform.position - campos).sqrMagnitude < distance1 * distance1 )
{
// use High LOD
HLOD.active = true;
MLOD.active = false;
LLOD.active = false;
}
else if ((transform.position - campos).sqrMagnitude < distance2 * distance2)
{
// use Medium LOD
HLOD.active = false;
MLOD.active = true;
LLOD.active = false;
}
else
{
// use Low LOD
HLOD.active = false;
MLOD.active = false;
LLOD.active = true;
}
}
This code worked like a charm for me.
Thank you very much for your help.
If they have different materials, you could change the material to not render anything, however it seems it would make a lot more sense to actually use three gameobjects if you need to do this.