How to make the character rotate

I am trying to make an AirPlane in my game. I have a script that make it move forward ALL the time, which makes the game more realistic. BUT i wanted to also rotate the plane with A and D to Left and Right. The problem is that i don’t know how to make this… How do i rotate an object with rigidbody to left and right in script?

I know somthing only about 2d. There is 2 way to do it. airplane.transform.rotation(vector 3) and airplane.transform.rotate(x,y,z) in first object move all the time by vector 3 given in parameter function second one rotete 1 time airplane to parameters in function

Next time give more information. Is your game 2d or 3d etc.

You want to use the object’s transform.localRotation
(Unity - Scripting API: Transform.localRotation)

You an assign an left/right angle as a rotation around the Y-axis like so:
gameObject.tranform.localRotataion= Quaternion.Eulers(0,angle,0);
(Unity - Scripting API: Quaternion)

A positive angle will rotate it one direction, a negative angle will rotate it the other direction.

Note: as you rotate the plane, it’s FORWARD direction of motion should probably change too! If so, make sure to use the transform’s forward direction for your motion:
gameObject.transform.forward defines the direction the transform is facing.
(Unity - Scripting API: Transform.forward)