Tell me, how can you realize 1 material on several objects that differ only in color?
Tried: MaterialPropertyBlock - created 1 common material.
public GameObject prefab; public GameObject[] cubes= new GameObject[3]; void Awake() { block = new MaterialPropertyBlock (); } void Start () { for (int i = 0; i < 3; i++) { cubes[i]=Instantiate (prefab, new Vector3 (i, 0, 0), Quaternion.identity); if (i == 0) { color = new Color (1, 1, 1); } else if (i == 1) { color = new Color (1, 0, 1); } else { color = new Color (0, 0, 1); } Renderer _renderer = cubes [i].GetComponent<Renderer> (); //_renderer.GetPropertyBlock(block); block.SetColor("_Color", color); _renderer.SetPropertyBlock(block); } } As a result: 1 common material is used, the color of each object is different, but the number of draw call is the same as creating material for each object (per object by draw call ), the material is in the shader [PreRendererData] .
How can I reduce draw call , if on the stage I have 50 objects with a material differing only in color?