title: How do I freeze rotation of a Rigidbody programatically?
body: <p>I am creating a 2D platformer game, and I already wrote the script that moves the sprite forwards and backwards successfully. However, I am <strong>extremely</strong> new to Unity and C#, so I have no idea how to freeze rotation of the sprite.</p>
  
  <p>I tried to do it programatically (because the use gravity option did not appear in inspector) like so-</p>
  
  <pre><code>void Update () {
  
      anim.SetBool("Grounded", grounded);
      anim.SetFloat("Speed", Mathf.Abs(Input.GetAxis("Horizontal")));
  
      rb2d.freezeRotation.freezeRotation = true;
  
  }
  </code></pre>
  
  <p>but it obviously doesn't work. <strong>How do I correctly freeze rotation of the sprite with c#? Where do I put this code?</strong></p>
  
  <p>Thanks in advance-
  George :)</p>