Closed ColColonCleaner closed 2 years ago
We might be able to get around this by having a trigger after setting changes that generates the JSON with a coroutine before the OnSave function triggers. So essentially the OnSave function can just grab an already created save state string and doesn't need to generate any JSON. That should speed up the save process considerably.
We can just set self.script_state when settings are changed, and return self.script_state from onsave.
Setting the script state when things change instead of on every onSave greatly improves framerate stability.
On the left is without 10 injected minis. The big dip in the middle is building a map with 10 injected miniatures contained. The right side is afterward. Notice the framerate dips every 10 seconds with all those minis loaded due to the OnSave tick.