Test method:
Each object has a large range of sine movement, creating 1000-5000 objects to ensure real-time update of the scene segmentation tree and testing the frame rate
Test script:
To move a script:
usingUnityengine;usingSystem.Collections; Public classtest1:monobehaviour{ PublicRigidbody rigidbodyobj; voidUpdate () {Switch(Random.range (0,3)) { Case 0: Transform.position= Vector3.forward * Mathf.sin (Time.time * the) * the; //rigidbodyobj.position = Vector3.forward * Mathf.sin (Time.time *) *; Break; Case 1: Transform.position= Vector3.left * Mathf.sin (Time.time * the) * the; //rigidbodyobj.position = vector3.left * Mathf.sin (Time.time *) *; Break; Case 2: Transform.position= Vector3.right * Mathf.sin (Time.time * the) * the; //rigidbodyobj.position = vector3.right * Mathf.sin (Time.time *) *; Break; } }}View Code
Generator script:
usingUnityengine;usingSystem.Collections; Public classtest2:monobehaviour{ Public intCount =10000; Publicgameobject template; voidAwake () { for(inti =0; I < count; i++) { varGo =instantiate (template); Go.transform.position= Random.insideunitsphere *10f; } }}View Code
Test results:
i5 under the configuration
500 Dynamics Open Rigid body collider is already less than 20fps, using rigidbody.position to move and use transform.position movement is not very different. and 500 rigid bodies with gravity open, collider only 3fps.
10,000 non-rigid collider can reach 30-35fps and are independent of whether the switch trigger. Since the non-rigid body collider is a passive trigger, I have also tested a situation where there is no collider, and it seems that the frame rate is fast 1-2fps and relatively stable, and may be an illusion.
Unity Collider and rigid body Collider performance comparison