I have a code that is instantiating around 1000 objects at the same location using a coroutine. The problem is that all those objects have a box collider with “isTrigger=true” and a kinematic rigidbody attached to them and because of that they are triggering this error:
“Too many pairs created, new pairs will be ignored. This is perhaps due to an excessive number of objects created at one location.”
Also, the game becomes slow while the objects are colliding with each other but as soon as they move and stop colliding with each other, it starts running smoothly.
I tried to setup the Layer-Based Collision Detection of Physics in order to ignore the collision of all these objects between themselves but the error still appears.
So what can I do in order to have multiple instances of those objects at the same location and also check for collisions only with another 2 object layers?
EDIT
I forgot to mention that I need it to work smothly on Android and iOS with a maximum of 500 objects at the same initial location (because after they move out of collision with themselves, they already move smoothly)
EDIT 2
It works fine with +/- 500 objects on editor but on Android it doesn’t work well.
On editor, if I try to create 1000 objects then I get +/- the same frame rate as in Android.
EDIT 3
As asked, I created a simple example project that shows what’s happening. Just open it, hit play and se what happens when the cubes appear and start to move.
[23527-new+unity+project+2.zip|23527]