Search Unity

Editor scripts can't access persistentDataPath, Unothorized Exception [SOVED]

Discussion in 'Scripting' started by unity_P-dQObz0sCT9rQ, Dec 12, 2019.

  1. unity_P-dQObz0sCT9rQ

    unity_P-dQObz0sCT9rQ

    Joined:
    Aug 28, 2019
    Posts:
    6
    Hello,

    I need my Editor scripts to save a Json to somewhere in my drive, and both persistentDataPath and StreamingAssets give me Unauthorized Access Exceptions.
    Note that:
    • I can access them just fine when my game is running from other sripts
    • I've checked the permissions
    • I've disabled antiviruses
    [ISSUE SOLVED]

    For posterity:
    I was calling System.IO.File.WriteAllText(path, JsonSaveString); from a static method in a static class.

    Putting it back into the MonoBehaviour seems to have solved the problem.
     
unityunity