Im having a problem with code and its saying: The type or namespace name 'Player' could not be found

I am currently trying to make a Player Save data in my game, and currently I am making a C# file to do this, but when I save the code it shows an error saying:

Assets\SaveSystem.cs(7,36): error CS0246: The type or namespace name ‘Player’ could not be found (are you missing a using directive or an assembly reference?)

This is the Code that I am using for this:

using UnityEngine;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

public static class SaveSystem {

    public static void SavePlayer (Player player)
    {
        BinaryFormatter formatter = new BinaryFormatter();

        string path = Application.persistentDataPath + "/player.save";
        FileStream stream = new FileStream(path, FileMode.Create);

        PlayerData data = new PlayerData(player);

        formatter.Serialize(stream, data);
        stream.Close();
    }

    public static PlayerData LoadPlayer()
    {
        string path = Path.Combine(Application.peristentDataPath, "/player.save");
        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream stream = new FileStream(path.FileMode.Open);

           
            PlayerData stream = formatter.Deserialize(stream) as PlayerData;
            Stream.Close();

            return data;
        }
        else
        {
            Debug.LogError("Save file not found in " + path);
            return null;
        }
     } 
}

This code is what I am using, and the other C# Script im using is:

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

    [System.Serializable]
public class PlayerData {

    public int level;
    public int health;
    public float[] position;

    public PlayerData (Player player)
    {
        level = player.level;
        health = player.health;

        position = new float[3];
        position[0] = player.transform.position.x;
        position[1] = player.transform.position.y;
        position[2] = player.transform.position.z;
    }


}

I cannot identify why I am having this problem and was hoping someone on here could help.

Do you have any class named “Player” in your project?

No I do not believe so…

You need one. Go back to whatever tutorial you got the code from, there’ll be a class called “Player” somewhere (most likely in a file called Player.cs), grab that.

Looking at it, it looks like Player is a MonoBehaviour, so maybe the creator of the tutorial just expected you to replace the class name Player with whatever script you have on your main player object.

I fixed the bug a few days ago and forgot this post exists