I have performance issues with my little project. It creates a lot objects (over 25000), they all have to constantly move and collide with each other (even outside of screen). After few days I just don’t know what else I can do.
These objects on creation pick one direction and random speed and move forever in that direction.
I shouldn’t use rigidbodies, since I don’t need complicated physics for that.
BUT
Using just colliders and moving transforms is even worse.
I tried multithreading, but it’s pointless since I can’t interact with Unity API outside of main thread.
Calling Update for all these objects consumes around 50 fps! (even if it does nothing)
I just ran out of ideas It needs to perform in shortest time possible and max fps I got it was 7…
Well, knowing why you need it could help a lot remplacing those 25k objects into another logic that might produce the same result without having to create real monobehaviour objects. (And make that logic being able to be called in another thread and just send the result to the Unity API)
Maybe you could create your own physic logic using only X and Y coordonates, speed, and direction as floats, and run calculations to determine if two objects are going to collide and when they are going to, and use maths to determine the result of the collision.
Maybe there are other ways of getting the result you need, but it require us to know why you need that much objects.