Search Unity

Turning off rigidbody2d

Discussion in 'Editor & General Support' started by RoyalKingZB, Sep 29, 2021.

  1. RoyalKingZB

    RoyalKingZB

    Joined:
    Sep 23, 2021
    Posts:
    4
    Hi! I've been making my game for the last week or so but I didn't realize I'm having such a huge fps hit until today when I turned on the fps counter. Anyways, I'm trying to turn off the Rigidbody2D.simulated but no matter what I do, it's not turning off the simulated tick mark in-game. If you knew of a way to just out right remove the rigidbody, that'd also work cause I don't need it. I've seemingly tried everything I could find on google and youtube.

    Here's my code that I've tried:

    Code (CSharp):
    1. //Manually entered in the inspector as a prefab
    2. public Rigidbody2D thisRB;
    3.  
    4. //Later in the script after things are done doing its thing
    5. thisRB.simulated = false;
    6.  
    7. //I've also tried destroying it
    8. Destroy(thisRB);