Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Save and load system problems

Discussion in 'Scripting' started by Lil_Potatoe, May 21, 2021.

  1. Lil_Potatoe

    Lil_Potatoe

    Joined:
    Feb 2, 2021
    Posts:
    16
    Hey, I recently followed Brackeys tutorial on how to create a save and load system and I have a few problems that I can't quite find out how to fix. When I try to save the players data, it says " Access to path "/player.fun" is denied. I don't know if it because of the ".fun" file type I followed from the tutorial or if its something to do with the fact that I'm using a mac. Thanks for helping in advance and my scripts are below.
     

    Attached Files:

  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,756
    "/player.fun" is a root file. You're never gonna get access to that file. Well, MAYBE if you're running as admin / root!!

    You have to use Application.persistentDataPath (check out the docs on that) to create a valid filename to save in.
     
    Joe-Censored likes this.
  3. Lil_Potatoe

    Lil_Potatoe

    Joined:
    Feb 2, 2021
    Posts:
    16
    Thanks for the help. All I had to do was remove the / from the file name and it works perfectly now.
     
    Kurt-Dekker likes this.