Saving/ Loading Script Weird Bug

I don’t know if it’s because I have a mac or if I messed up somewhere, but this script isn’t working for some reason. I get an error that says Unexpected Symbol on the 20th line of code (20, 24).

Here’s my code:

using UnityEngine;
using System.Collections;
using System;
using System.Text;
using System.IO;

public class SaveGame : MonoBehaviour {
	String path;
	String fileName;

	// Use this for initialization
	void Start () {
		fileName = "/gameSave.txt";
	}
	
	// Update is called once per frame
	void Update () {
		path = Application.dataPath + fileName;
			
		using (FileStream fs = File.Create(path)){
			AddText(fs, "Your Game is Saved");
	}
	
	private static void AddText(FileStream fs, string value){
        byte[] info = new UTF8Encoding(true).GetBytes(value);
        fs.Write(info, 0, info.Length);
    }
}

Two things I notice:

  • There seems to be a hidden control character in your text, immediately following the opening paren in using (FileStream
  • You have unbalanced parens. Looks like you need another closing paren at the end of your Update() function.