I want to change an object’s kinematic state from a script so that sometimes it’s under script control and sometimes it’s under physics control. But from a script all that works is setting isKinematic = true. Setting isKinematic = false from a script has no effect. Works both ways in the Inspector.
For example, I have a single object in the scene. If I run with isKinematic = false, it falls immediately. If I run with isKinematic = true, it does not move, as it should. But if I add a button that switches the state, it does not behave as I expect it to. If I run with isKinematic = false, the body starts falling but stops when I click the button to set isKinematic = true. But if I click again and set isKinematic = false, it does not start falling. But if I check the box in the Inspector, it starts falling again.
How can I change an object’s kinematic state from a script so that physics control resumes?