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?

  • You still have created 50 materials. Only use gpu instansing (if the system supports). - Xumera_hZ
  • And it does not help, nothing changes. Creating materials with all colors is not an option (since the color on objects does not repeat) - Stelette

1 answer 1

https://docs.unity3d.com/Manual/GPUInstancing.html Everything is detailed. (You need to read it for the new version, for older versions the dock is worse). PS Does not work with Canvas Renderer