Question by
Worldkiller556 · Jan 12, 2017 at 09:03 PM ·
error message
I need some help fixing some code
With this code i am working with and it says there is an error in line 26, symbol 17 and in line 28 symbol 1. can anyone tell what errors if any there are and how to fix them. using UnityEngine; using System.Collections; using System.Collections.Generic; using System.Runtime.Serialization.Formatters.Binary; using System.IO;
public static class SaveLoad {
public static List<Game> savedGames = new List<Game> ();
public static void save() {
savedgames.Add (Game.current);
BinaryFormatter bf = new BinaryFormatter ();
FileStream file = File.Create (Application.persistentDataPath + "/savedGames.gd");
bf.Serialize (file, SaveLoad.ASP);
file.Close ();
}
public static void Load() {
if(File.Exist(Application.persistentDataPath + "/savedGames.gd"))
{
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Open (Application.persistentDataPath + "/savedGames.gd", Filemode.Open);
SaveLoad.ASP = (List<Game>)bf.Deserialize(file);
file.Close ()
}
}
}
Comment
Please, format your code correctly, or mark the error lines in the code. Also, could you include the code for the SaveLoad class?
Add a semi-colon ;
to the end of line 25. Like so
file.Close ();
Your answer
![](https://koobas.hobune.stream/wayback/20220612104710im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Keep getting Null reference error for AI Script 1 Answer
Unity 2017 playmode is not working 0 Answers
IndexOutOfRangeException in TextureInspector 1 Answer
grandle build fail 0 Answers