i don't see my player when my camera move

Hi, i’m new with unity, i’m trying to create a simple 2d game, a space-shuttle must not hit asteroids by moving up and down. But when I move the camera in the direction of the spacecraft I don’t see the spacecraft.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class spostamentoCamera : MonoBehaviour
{
    public GameObject astronave;
 
    void Start()
    {
       
    }

    // Update is called once per frame
    void FixedUpdate()
    {
      
        Camera.main.transform.position = astronave.transform.position + new Vector3(9,0,0);
    }
}

this is what i see

How can i solve this?

Camera stuff is pretty tricky… if you persist in writing your own camera controllers, you must get familiar with how a camera faces in the +Z direction.

You are actually offsetting the camera +9 in the X direction, so of course the ship is out of sight.

You can use .LookAt() to make the camera look at something, and if it is visible from that angle it would show. If the ship is flat in the X/Y plane, viewing it from X+9 would make it infinitely thin and invisible.

Honestly it might be best to use Cinemachine from the Unity Package Manager.