Hi.
I’m trying to save data whenever the player triggers a checkpoint, but the process takes 0.2 seconds or so and causes a lag spike that players shouldn’t see.
How can I make it so the process works without stopping everything else?
Try using a Coroutine or saving only specific stuff. Even though the Coroutine approach will most likely fix it, you could create properties for every variable save that could run some kind of function that registers that a value has been changed. When saving, you can then deserialize, update only the values that were changed, and then serialize. Alternatively, you could write your own serializer as people generally consider C#'s default serializers to be unnecessarily slow.