Rotate 3D character

I took my first Unity class recently, and this is the code we had for changing the direction the character faces in a 2D platformer:

void Flip() {

    Vector3 scale = gameObject.transform.localScale;

    facingRight = !facingRight;

    scale.x = -scale.x;

    gameObject.transform.localScale = scale;

}

I would like to know the simplest way to change this for a 3D character, for a similar sidescrolling game. Everything I’ve looked at seems to throw a lot at you, and I’m still pretty new to the coding side of things.

Try changing the 180 to different other numbers if it doesn’t work.

  void Flip () {
          transform.Rotate (new Vector3(0, 180, 0));
    }