I have created a prefab which is square with rounded corners. The attached components are Rigidbody 2D and Polygon Collider 2D. A Physics Material 2D is used for both components with Friction: 0.4 and Bounciness: 0. Multiple of these prefabs are dropped from the top of the screen and collide with each other at the bottom of the screen and stack on top of each other.
- On Android devices, it’s working as expected. There is no bounce and when the objects are done falling they don’t move.
- On IOS, with the same settings, the objects bounce a bit and after done falling they continuously move and shake slightly. Multiple times this is causing the object to merge together.
I’m having the same problem. Using Unity as a Library, I have two square RigidBody2Ds, with one being a player, both having BoxCollider2D. On Android or macOS preview the squares fall and land on platforms, on iOS they bounce into the sky!
Am I doing something obviously wrong here? No scripts were created.
I didn’t have this problem with Unity 2021 LTS but I do with 2022.2 and 2023.1. But since UaaL requires 2022 for Android I upgraded and can’t find a solution to this problem anywhere.
did anyone solve it? this is ridiculous. It works as intended in the simulator and on Android: the boxes land on the ground. but on iOS the colliders fall through each other (see video)
- Unity: 2022.2.16f1
- Ground has a static RigidBody with a Box Collider 2d and a standard 2d material (0.4, 0)
- Boxes have dynamic Rigidbody 2d with continuous collision detection (also tried the discrete option) and a material (0.4, 0.1)
What I ended up doing is to set a ground collider as kinematic and freezing all the coordinates (before it was static)
There are a few good links that explain different behaviors:
How to stop falling through floors and colliders in Unity – John Stejskal : Software and Game Developer
https://diegogiacomelli.com.br/apps/collider-interactions/
What is not explained anywhere, though is why the hell it has problems only on iOS…
I have exacty this issue, too - works fine on other builds except iOS/XCode, where the colliders appear to stop working correctly. Is it a known bug that I should wait for an update, or is there a way around it?
No idea what “stop working correctly” means but there’s a bug report that landed last week which is being dealt with here: Physics2D broken on iOS specifically - Unity Engine - Unity Discussions
Might be related to your problem if it’s 2022.2.0b8 onwards.
Thanks for the update and apologies for the lack of description.
No problem, it’s the only bug reported for 2D physics currently and I’m working exclusively on it now (for the last few days TBH). Bit of a devil of a bug to track down!