Błąd kompilatora przy serializacji

0

Próbuje serializować dane ale wyskakują mi błędy
Assets\Scripts\saveScript.cs(19,20): error CS0246: The type or namespace name 'Save' could not be found (are you missing a using directive or an assembly reference?)
w 3 liniach 19, 37 i 42 czyli wszędzie gdzie występuje save.

to mój kod:

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

[RequireComponent(typeof(GameData))]
public class saveScript : MonoBehaviour
{
private GameData gameData;
private string savePath;

void Start()
{
    gameData = GetComponent<GameData>();
    savePath = Application.persistentDataPath + "/gamesave.ok";
}

public void SaveData()
{
    var save = new Save()
    {
        SavedInteger = gameData.GameInteger
    };

    var binaryFormatter = new BinaryFormatter();
    using (var fileStream = File.Create(savePath))
    {
        binaryFormatter.Serialize(fileStream, save);
    }

    Debug.Log("Data Saved");
}

public void LoadData()
{
    if (File.Exists(savePath))
    {
        Save save;

        var binaryFormatter = new BinaryFormatter();
        using (var fileStream = File.Open(savePath, FileMode.Open))
        {
            save = (Save)binaryFormatter.Deserialize(fileStream);
        }

        gameData.GameInteger = save.SavedInteger;
        gameData.ShowData();

        Debug.Log("Data Loaded");
    }
    else
    {
        Debug.LogWarning("Save file doesn't exist.");
    }
}
}

1

Nie brakuje tu Namespace?

0

To nie jest BŁĄD KOMPILATORA. Jakżeż miło wszelkim początkującym znazdowac błędy kompilatorów, systemów operacyjnych fazy ksiezyca i nie wiem jeszcze czego.

Kompilator w tym przypadku jest bezbłędny.
Jest to błąd KOMPILACJI jakiegoś konkretnego modułu źródłowego (co podał kolega @WeiXiao )

0

@AnyKtokolwiek: dzięki za poprawienie i już sam rozwiązałem problem po prostu miałem 1 literę małą zamiast dużą

1 użytkowników online, w tym zalogowanych: 0, gości: 1