I’ve found recently with plugins such as my own have difficulty saving data due to inconsistent behavior with the plugin data getter and setter methods.
This makes it difficult as a plugin developer, especially if the plugin heavily relies on save data (such as the one linked above), as it is entirely out of the user’s control. Doing methods such as double-checking or double-saving do not work at all.
Because this behavior is inconsistent, it is difficult to directly reproduce, and therefore I cannot provide any direct reproduction steps. However, “data loss” seems to occur once the user closes the Studio session and begins a new one later on. This happens at seemingly random times.
If anybody else has a direct way to reproduce this, please let me know so that I may update this post.
The specific behavior is that there’s only one central settings file per plugin, which does not interact well with multiple studio sessions open at the same time.
Studio Session 1: S1
Studio Session 2: S2
Sequence of events:
S1 loads a place
Plugin in S1 loads the data D1
S2 loads a place
Plugin in S2 loads the data D2
Plugin in S1 does some stuff to generate D1-new and saves it
Plugin in S2 does some stuff to generate D2-new and saves it… erasing D1-new
I don’t believe this is an issue with Studio, but rather with the unclear documentation on how exactly these methods work and how to best utilize them. When updating data, you should always load a fresh copy immediately before the update, so you catch any saves that could have happened in the meantime.
That’s not a workaround to any issue with Studio, but rather how you should have used these methods from the start. The documentation should mention this.
I am glad I found this since I am developing a plugin myself. Is there a workaround? I believe that setting the data in an external database is the only one as of right now but I feel like it is redundant to keep settings that should remain on the client.
But since the problem here is with multiple places then doesn’t this mean the problem will persist? Since the settings will be place-based and not replicated across all places.