Waiting for Saving/Loading?
What is the best way to wait for saving or loading to complete?
I'm currently using a Binary Formatter to save/load data but i'm not sure what's the best way to wait for the saving/loading to finish. I was thinking that maybe a coroutine would be the solution but i believe the coroutine would only be able to wait a specified set amount of time so it wouldn't guarantee that the saving/loading is complete.
Hope that makes sense and any help will be appreciated.
Cheers,
Answer by finlay_morrison · Jun 05, 2018 at 11:13 AM
the code after the save and load will not run after the save/load, as usually code works on one thing at a time. This is only true if you don't use a coroutene, so just have it save/load and you should be fine.
Answer by Tycellent · Jun 06, 2018 at 01:24 PM
@finlay_morrison in the case of a long save file progress wouldn't the player need to be notified and wait to ensure everything is saved? I understand the process could be very quick but we wouldn't want the player to leave or quit before the saving is complete. Ideally i'd like the binary formatter to let us know so the player can for example press "Ok" once the saving is complete.
Seeing as how we can "observe" the loading screens of scenes in Unity i was hoping there'd be something similar to the loading of scenes i.e. we're able to load a scene and its progress is displayed and once it finishes loading it'll notify the player.
Your answer
Follow this Question
Related Questions
BinaryFormatter - Save and Load lists of data? 0 Answers
Saving/loading inherited class scripts (C#) 1 Answer
Saving and loading an int variable on Android 1 Answer
Spawning loot only the first time a level is loaded 1 Answer
Data not Saving in Android Using Unity Persistance Saving Training. 1 Answer