0
0
UnityDebug / FixBeginner · 4 min read

How to Fix Physics Not Working in Unity: Simple Solutions

Physics may not work in Unity if Rigidbody components are missing or if objects are set to isKinematic. Ensure your objects have Rigidbody attached and that physics settings like gravity and collision layers are correctly configured.
🔍

Why This Happens

Physics in Unity stops working mainly because the object lacks a Rigidbody component or has isKinematic enabled, which disables physics forces. Another common cause is that the object is on a layer that ignores collisions or gravity is turned off globally or for that object.

csharp
public class BrokenPhysics : MonoBehaviour {
    void Start() {
        // Missing Rigidbody means no physics simulation
        // Also, isKinematic disables physics forces
        Rigidbody rb = gameObject.GetComponent<Rigidbody>();
        if (rb != null) {
            rb.isKinematic = true; // This line causes physics to not work
        }
    }
}
Output
The object does not move or respond to physics forces like gravity or collisions.
🔧

The Fix

Add a Rigidbody component to your object and make sure isKinematic is set to false. Also, check that gravity is enabled and collision layers allow interaction.

csharp
public class FixedPhysics : MonoBehaviour {
    void Start() {
        Rigidbody rb = gameObject.GetComponent<Rigidbody>();
        if (rb == null) {
            rb = gameObject.AddComponent<Rigidbody>();
        }
        rb.isKinematic = false; // Enable physics simulation
        rb.useGravity = true;   // Enable gravity
    }
}
Output
The object moves and reacts to gravity and collisions as expected.
🛡️

Prevention

Always add a Rigidbody to objects that need physics. Avoid enabling isKinematic unless you want to control movement manually. Regularly check collision layers and physics settings in the project. Use Unity's Physics Debug tools to visualize collisions and forces.

⚠️

Related Errors

  • Objects passing through each other: Check if colliders are set as triggers or if collision layers ignore each other.
  • Physics jitter or instability: Adjust Fixed Timestep in Time settings or increase Rigidbody interpolation.
  • Physics not updating in Play mode: Ensure the game is running and physics simulation is not paused.

Key Takeaways

Attach a Rigidbody component to objects needing physics simulation.
Set isKinematic to false to allow physics forces to affect the object.
Verify gravity and collision layers are properly configured.
Use Unity's Physics Debug tools to identify physics issues.
Avoid disabling physics unintentionally by checking component settings.