How do i rotate the space ship?

hi im new to unity! so im a noob trying to learn. I want my spaceship to move foward and backwards with up and down arrow, and to rotate left with the left key and right with the right arrow key. i have tried with quaternion and with getkeydown and cant seem to get it to work, or it justs rotates 180 degrees at once.
for the meantime i have so it moves without rotating but it just looks wrong. would apreciate the help. thanks!

![5238524--522737--SRunityHelp.jpg|1920x1080](upload://50pGfyVjczs2gPhDHS12dH5I3Ca.jpeg) void Update()
    {
        if(Input.GetKey(KeyCode.LeftArrow))
        {
            Vector3 position = this.transform.position;
            position.x--;
            this.transform.position = position;
        }
        if(Input.GetKey(KeyCode.RightArrow))
        {
            Vector3 position = this.transform.position;
            position.x++;
            this.transform.position = position;
        }
        if (Input.GetKey(KeyCode.DownArrow))
        {
            Vector3 position = this.transform.position;
        }
        if (Input.GetKey(KeyCode.DownArrow))
        {
            Vector3 position = this.transform.position;
            position.y--;
            this.transform.position = position;
        }
        if (Input.GetKey(KeyCode.UpArrow))
        {
            Vector3 position = this.transform.position;
            position.y++;
            this.transform.position = position;
        }
        if (Input.GetKeyDown(KeyCode.Space))
        {
            print("1");
            FireBullet();
        }

    }

Well, I am very new to Unity as well, but i do not see anywhere in your code were you are setting a rotation value, just a position…

Maybe something like

if (Input.GetKey(KeyCode.LeftArrow)){
transform.Rotate(0,5f,0);
}
if (Input.GetKey(KeyCode.RightArrow)){
transform.Rotate(0,-5f,0);
}
Again, I am new, so code may not be exact.

Quick google search with “unity rotate object” gives you many alternatives and tutorials.

You should add to your current rotation, using (usually) delta time and your rotation speed as multiplier.

Same goes for your position, now you are just adding or reducing 1 unit when a key is pressed, definitely something you don’t want unless you want to move step by step.

In cases where you want to combine both rotation and moving forward (relative to current heading) you should move along your transform forward axis, not by just adding to one of the position axes (x, y or z) which will make your character/ship move only along main world axes, like you do now.

See:

Sounds like you want something like the old Asteroid game

something like this?

if that is the case, a quick youtube search gave me a playlist of a guy who makes an asteroid game from scratch in unity that might help you out