Search Unity

Question What values change when I apply AddForce to a RigidBody?

Discussion in 'Getting Started' started by tleylan, Dec 8, 2022.

  1. tleylan

    tleylan

    Joined:
    Jun 17, 2020
    Posts:
    621
    I'm debugging a case where I see the code execute but the values don't appear to change. So one "bullet" is used for comparison and the second one has AddForce applied to it's Rigidbody.

    I can't see any differences inspecting the object so I'd like to know which properties to check.
    Thanks.
     
  2. tleylan

    tleylan

    Joined:
    Jun 17, 2020
    Posts:
    621
    I still wouldn't mind having an idea about what changed but I was able to solve my issue.

    I was pooling the bullets in a Queue and as I pushed them into the Queue I was calling bullet.SetActive(false). Obviously setting it back to true as I pulled them out. BUT... setting the object inactive is somehow affecting the Rigidbody in seemingly such a way as it can't be resurrected.

    I comment out the SetActive and it all works perfectly.