Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to clear or delete saved data #16

Closed
CraftedPvP opened this issue Mar 14, 2021 · 0 comments
Closed

Unable to clear or delete saved data #16

CraftedPvP opened this issue Mar 14, 2021 · 0 comments
Assignees
Labels

Comments

@CraftedPvP
Copy link

CraftedPvP commented Mar 14, 2021

Describe the bug
Deleting a save game in a standalone build doesn't work because Player.log is currently being used by a process. I've ended all processes except the game but it doesn't work. I tried restarting my computer as well

To Reproduce
Steps to reproduce the behavior:

  1. Calling a function that calls SaveGame.Clear() or SaveGame.DeleteAll() prints this error.

Expected behavior
It should clear all saved data.

Screenshots
After clicking new game, this error appears
image

Error message:

IOException: The process cannot access the file 'C:\Users\hi\AppData\LocalLow\company\game name\Player.log' because it is being used by another process.
  at System.IO.__Error.WinIOError (System.Int32 errorCode, System.String maybeFullPath) [0x001d7] in <2b3a3162be434770b7a4fac8b896e90c>:0 
  at System.IO.FileInfo.Delete () [0x00038] in <2b3a3162be434770b7a4fac8b896e90c>:0 
  at BayatGames.SaveGameFree.SaveGame.DeleteAll (BayatGames.SaveGameFree.SaveGamePath path) [0x00037] in <81391f8c6baa4ae7b039f97e592f680c>:0 
  at BayatGames.SaveGameFree.SaveGame.Clear () [0x00005] in <81391f8c6baa4ae7b039f97e592f680c>:0 
  at QLE.NormalPanel.ClearSavedData () [0x00001] in E:\projects\game name\Assets\Scripts\UI\Main Menu\NormalPanel.cs:50 
  at UnityEngine.Events.InvokableCall.Invoke () [0x00010] in C:\buildslave\unity\build\Runtime\Export\UnityEvent\UnityEvent.cs:180 
  at UnityEngine.Events.UnityEvent.Invoke () [0x00022] in C:\buildslave\unity\build\Runtime\Export\UnityEvent\UnityEvent\UnityEvent_0.cs:58 
  at UnityEngine.UI.Button.Press () [0x00027] in E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\Button.cs:68 
  at UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) [0x00010] in E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\Button.cs:110 
  at UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00001] in E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\ExecuteEvents.cs:50 
  at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) [0x00074] in E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\ExecuteEvents.cs:262 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1) (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\ExecuteEvents.cs:266)
UnityEngine.EventSystems.StandaloneInputModule:ReleaseMouse(PointerEventData, GameObject) (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules\StandaloneInputModule.cs:187)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMousePress(MouseButtonEventData) (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules\StandaloneInputModule.cs:641)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent(Int32) (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules\StandaloneInputModule.cs:547)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent() (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules\StandaloneInputModule.cs:527)
UnityEngine.EventSystems.StandaloneInputModule:Process() (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules\StandaloneInputModule.cs:282)
UnityEngine.EventSystems.EventSystem:Update() (at E:\Coding\Unity-2019\2020.2.1f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\EventSystem.cs:385)

Desktop:

  • OS: Windows 10
  • Version 10.0.19042

the code in the button is just
image
btw, the scriptable object code does not do any calls in SaveGame

@hasanbayatme hasanbayatme self-assigned this Mar 15, 2021
hasanbayatme added a commit that referenced this issue Apr 1, 2022
Fixes #9
Fixes #11 and #16 by adding IgnoredFIles and IgnoredDirectories that allow you to add any file or directory to be excluded from SaveGame API, the default values are "Player.log" and "output_log.txt" for files and "Analytics" for directories
IOSupported method is now deprecated
Added UsePlayerPrefs option to allow the user to specify whether to use PlayerPrefs as storage or not (otherwise it uses file storage)
Added OnSaving and OnLoading events that occurs at the start of the processes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants