- Home /
 
               Question by 
               Yashiz · Oct 24, 2017 at 11:59 AM · 
                materialeditor-scriptingplaymodecombinemeshessubmesh  
              
 
              How to know which material is used by a submesh in script ?
Hi,
In Unity 2017.1.2f1, Unity combines static meshes into one big mesh in play mode. I would like to know how to know which material that each submesh uses?
Imagine I have two static mesh game objects, one material for each. In playmode, I can still see these two game objects in the hierarchy, if I use FindObjectsOfType(typeof(MeshRenderer)), I can still get two meshRenders and each of them have one material. However, meshRender.GetComponent().sharedMesh is the same combined mesh with subMehCount as 2. Therefore, it is not clear which subMesh uses which material.
Thanks,
Yashiz
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                