- Home /
iPhone shader problem with combined meshes.
Hi, I am using the following code to combine 500 meshes into a single mesh using CombineMeshes with CombineInstance:
using UnityEngine; using Random = UnityEngine.Random;
 
               [RequireComponent(typeof(MeshFilter))]
 public class TestInstancer : MonoBehaviour { public Mesh Instance; public int InstanceCount = 500;
  void Awake()
 {
     CombineInstance[] combine = new CombineInstance[InstanceCount];
     for (int i = 0; i < InstanceCount; i++)
     {
         Vector3 pos = new Vector3(i, 0, 0);
         combine[i].mesh = Instance;
         combine[i].transform = Matrix4x4.TRS(pos, Quaternion.AngleAxis(0, new Vector3(0f, 1f, 0f)), new Vector3(1,1,1));
     }
     GetComponent<MeshFilter>().mesh.CombineMeshes(combine);
 }
 } 
This combined mesh uses a material with the unlit texture shader. It is correctly being displayed in Unity PC and Mac, however the combined mesh is being rendered as black on the iPhone. I have tried other shaders, esp. the mobile ones, but the mesh is either black or not visible at all on the iPhone, but work's on the other platforms. What am I doing wrong?
I've never used Combine$$anonymous$$eshes. Are you sure the shaders are working for you with non-combined meshes?
I'm using the internal shaders. And they work on the combined mesh on PC and $$anonymous$$ac, but not on the iPhone. I guess I am overlooking some platform specfic detail somewhere, which may not even be shader related. I don't know.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                