Unity: Difference between revisions

101 bytes added ,  4 September 2020
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
__FORCETOC__
__FORCETOC__


Unity is a game development framework and game engine. It has a shallow learning curve and is very capable, supporting most popular platforms and features including AR and VR.
Unity is a game development framework and game engine. It has a shallow learning curve and is very capable, supporting most popular platforms and features including AR and VR platforms.


== Shaders ==  
== Shaders ==  
Line 33: Line 33:
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>


===Merging Mesh===
====Merging Meshes====
If you need thousands of simple objects, one way is to use merge all of the meshes.   
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.   
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. Otherwise, merging them on the CPU is more efficient.   
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.
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; transparency can become tricky.


You can use a compute shader to animate and move the objects instead of using Unity scripts.   
You can use a compute shader to animate and move the objects instead of using Unity scripts.