I wrote a code: col.gameObject.GetComponent<Rigidbody2D> ().bodyType = RigidbodyType2D.Static;
But it pauses the playmode.
I have no idea how that can happen. There’s no editor code whatsoever in the Rigidbody2D code. It certainly doesn’t call into the editor and set it to be paused. Something else must be going on here.
Actually a static RB was colliding with a dynamic one. When I set both to static, problem was solved.
I don’t follow at all how that pauses the editor but it seems you are okay now.
In my game when an object falls on an object its rigidbody becomes static. But the object it falls on is of type dynamic. In documentation it is stated that static object only collides with static ones. So I changed the other object’s type to static also. Now it is doing fine.
It probably paused because Unity encountered an error, it should show in the console.
There was no error but after changing body types of both of the objects problem was solved.