I need to summon projectiles

I cant figure out how to make the prefab instantiate facing the player, then fire.

    int randomO;
    float randomY;
    float randomX;
    public GameObject projectilePrefab;
    public Transform spawner;
    public Transform player;
    public float WaterSpeed;

    private float time;
    public float maxtime;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        randomO = Random.Range(1, 5);
        switch(randomO)
        {
            case 1:
                randomY = 62.9f;
                randomX = Random.Range(-83.9f, 83.1f);
                break;
            case 2:
                randomY = -66.8f;
                randomX = Random.Range(-83.9f, 83.1f);
                break;
            case 3:
                randomX = -107.9f;
                randomY = Random.Range(48.7f, -58.7f);
                break;
            case 4:
                randomX = 100.6f;
                randomY = Random.Range(48.7f, -58.7f);
                break;
        }

        transform.position = new Vector2(randomX, randomY);

        if (time <= 0.0f)
        {
            //Heres where i want to instantiate the object.
            time = maxtime;
        }

    }

    private void FixedUpdate()
    {
        if (time >= 0.0f)
        {
            time -= Time.deltaTime;
        }
    }

I didn’t test that but I think you can rotate the prefab in the prefab mode then save then should work. Didn’t test that but I think it should work.

I’d go with something like this:

         if (time <= 0.0f)
         {
             //Heres where i want to instantiate the object.
            GameObject myProjectile = Instantiate(projectilePrefab, spawner.position, spawner.rotation , spawner)
         myProjectile.transform.LookAt(player.position);

             time = maxtime;
         }

You could probably also do this by replacing spawner.rotation with player.rotation and multiplying that with some Quaternion to turn the game object the way you want.