playMaker

Author Topic: Json save/load error sharing violation on path  (Read 33805 times)

hyperbeamart

  • Playmaker Newbie
  • *
  • Posts: 10
Json save/load error sharing violation on path
« on: June 06, 2025, 08:54:42 AM »
Hi,

I'm having an issue with the json save/load actions from the ecosystem. I can save a file and load it once just fine, sometimes it will even let me do it 4 or 5 times, then I start getting this error every time I try to save:

IOException: Sharing violation on path C:\Users\name\AppData\LocalLow\My Company Name\My product name\MySaveFile.sav

I've read this error can occur when other programs are accessing the file, so I made sure all my file explorers are closed, didn't help.

I have a new empty project with only playmaker installed, in my test scene there is only one gameobject with one FSM, with an empty start state, a json save state and a json load state.

Using unity 2022.3.44f1

I've used json save/load on entire projects before and I've never had this issue...Any help would be greatly appreciated!

[UPDATE]
I set up a state to delete the file every time before the json save happens, and found that access was denied with the same error message upon trying to delete the existing file...So perhaps it is not an issue with json save and somehow my computer is the one blocking access to that file? I tried disabling virus protection, that didn't help...
« Last Edit: June 06, 2025, 01:21:34 PM by hyperbeamart »

IreneDJones

  • Playmaker Newbie
  • *
  • Posts: 1
Re: Json save/load error sharing violation on path
« Reply #1 on: July 24, 2025, 03:34:57 AM »
Have you tried running Unity as administrator it might help with the file access issue!

colpolstudios

  • Sr. Member
  • ****
  • Posts: 365
Re: Json save/load error sharing violation on path
« Reply #2 on: August 19, 2025, 08:44:12 AM »
Hi,

I'm having an issue with the json save/load actions from the ecosystem. I can save a file and load it once just fine, sometimes it will even let me do it 4 or 5 times, then I start getting this error every time I try to save:

IOException: Sharing violation on path C:\Users\name\AppData\LocalLow\My Company Name\My product name\MySaveFile.sav

I've read this error can occur when other programs are accessing the file, so I made sure all my file explorers are closed, didn't help.

I have a new empty project with only playmaker installed, in my test scene there is only one gameobject with one FSM, with an empty start state, a json save state and a json load state.

Using unity 2022.3.44f1

I've used json save/load on entire projects before and I've never had this issue...Any help would be greatly appreciated!

[UPDATE]
I set up a state to delete the file every time before the json save happens, and found that access was denied with the same error message upon trying to delete the existing file...So perhaps it is not an issue with json save and somehow my computer is the one blocking access to that file? I tried disabling virus protection, that didn't help...

The issue that you describe is most likely due to not leaving your save state. Don't put the loading in the same FSM where you're saving. Example playable Demo: https://colpolstudios.itch.io/enemy-saving-and-loading-with-playmaker-arraymaker

coeddie11

  • Playmaker Newbie
  • *
  • Posts: 1
    • paper io
Re: Json save/load error sharing violation on path
« Reply #3 on: August 20, 2025, 05:45:26 AM »
It looks like the file stream isn’t being closed properly after saving, so try adding a “Close File” action or ensure the save action is wrapped in a using/dispose block to release the lock before the next write.

vallevels

  • Playmaker Newbie
  • *
  • Posts: 1
Re: Json save/load error sharing violation on path
« Reply #4 on: Today at 12:01:33 AM »
Interesting problem! The "Sharing violation" error points to file access issues. Have you tried checking if Snow Rider (just had to mention it!) or another background process might be locking the .sav file? The deletion error is definitely key. Maybe try running Unity as administrator. Good luck!