Unity: Difference between revisions

97 bytes added ,  11 February 2020
Line 31: Line 31:
=== Instancing ===
=== Instancing ===
If you need multiple instances of the same object, make sure that the material is instanced so that all objects only consume one draw call.<br>
If you need multiple instances of the same object, make sure that the material is instanced so that all objects only consume one draw call.<br>
Do not attach scripts to thousands of objects. Instead use one object.<br>
See [https://docs.unity3d.com/Manual/GPUInstancing.html Unity: GPUInstancing].<br>
Do not attach scripts to thousands of objects. Instead use one script on one object.<br>
If you need thousands of simple objects, one way is to use a mesh with one vertex per object and expand them in the geometry shader.<br>
If you need thousands of simple objects, one way is to use a mesh with one vertex per object and expand them in the geometry shader.<br>
You can use one compute shader to animate and move the objects instead of using Unity scripts. The compute shader edits the compute buffer which can be read by your vertex or geometry shader.<br>
You can use one compute shader to animate and move the objects instead of using Unity scripts. The compute shader edits the compute buffer which can be read by your vertex or geometry shader.<br>