- Home /
Question by
jukke · May 29, 2011 at 10:58 AM ·
gameobjectinstancemeshfilter
How do I get the Mesh Filter name from instance?
How do I get the Mesh Filter name from instance?
I got this code:
var instance : GameObject = Instantiate(Resources.Load(targetModel)) as GameObject;
And I would like to print the name of the mesh filter in the debug log:
Debug.Log( something be here? );
Comment
Best Answer
Answer by Statement · May 29, 2011 at 11:18 AM
The mesh filter name is the same name as the game object:
Debug.Log(instance.name);
If you want to find the name of the mesh the mesh filter is using:
var meshFilter = instance.GetComponent.<MeshFilter>();
var mesh = meshFilter.sharedMesh;
Debug.Log(mesh.name);