5,337
edits
No edit summary |
|||
Line 33: | Line 33: | ||
See [https://docs.unity3d.com/Manual/GPUInstancing.html Unity: GPUInstancing].<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> | 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. | |||
You can use | ===Merging Mesh=== | ||
If you need thousands of simple objects, one way is to use merge all of the meshes. | |||
For simple objects, you can create a mesh with one vertex per object and expand them in the geometry shader such that they're all drawn in a single draw call. | |||
Both methods will ensure all objects are drawn in a single draw call. Be aware of the limitations of using a single draw call though. | |||
You can use a compute shader to animate and move the objects instead of using Unity scripts. | |||
The compute shader edits a single compute buffer which can be read by your vertex or geometry shader without passing data back to the CPU. | |||
==References== | ==References== | ||
* [https://docs.unity3d.com/Manual/index.html Unity User Manual] | * [https://docs.unity3d.com/Manual/index.html Unity User Manual] | ||
* [https://www.udemy.com/course/the-ultimate-guide-to-game-development-with-unity/ Basic Game Dev Course ( | * [https://www.udemy.com/course/the-ultimate-guide-to-game-development-with-unity/ Basic Game Dev Course (Udemy, ~$12)] |