Answer the question
In order to leave comments, you need to log in
unity. Does the game slow down when two colliders touch?
Good day everyone. Newbie, I'm making a 2d clicker on Unity, there is a gameObject (basket). When you tap on the screen, fruits fall into it. Rigidbody and edge collider hang on the basket, fruits are prefabs, rigidbody and polygon collider hang on them. After the build of the test apk, after the appearance of 3-4 fruits in the basket, everything starts to lag terribly. You can destroy objects when they appear in the basket, but you want them to hang there until the basket is full. Those objects that fly past the basket are destroyed using an additional edge collider with a script on it.
How to understand why the lags are coming? And how to fix this whole thing.
I apologize for the clumsy explanation, I'm new to this.
Answer the question
In order to leave comments, you need to log in
Regardless of what platform you have, development language, framework used, etc., at the moment there is no hardware (and mobile phones are very limited in this matter) that can display transparent sprites (textures) on top of each other without loss of performance. You almost certainly end up with several transparent textures there (in addition to fruits, they probably stuck 2-3 textures in the interface), you exceed the limit, after which software overlay starts working instead of hardware overlay.
A universal solution - after the fruit has fallen into the basket, draw it into the general texture of all the fruits that have fallen into it, and delete the object itself. Thus, you can have any number of them in your basket. In the same way, you can calculate the collision area to estimate where a new piece of fruit will fall by simply changing the configuration of one object, instead of having the machine calculate a bunch of objects each time.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question