plugin:SetSetting() & plugin:GetSetting() do not function as intended

Hello,

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.

@tnavarts Has reproductions steps below! ^v^

7 Likes

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

3 Likes

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
2 Likes

That’s good to know for sure. However, it shouldn’t erase the data altogether.

Indeed, and plugin settings are being worked on. Just filling you in on exactly what the circumstances are since you were unclear.

4 Likes

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.

That is how the example plugin works already.

1 Like

To my knowledge, it’s not made clear why this is the case and that is why developers are getting confused by this behavior.

1 Like

This issue is still occurring, and causes a lot of issues for my Studio Levels plugin.

For some users, this is rendering my plugin completely useless, because progress will be reset at any time.

This still happens on every device regardless of specs.

Update, this issue is still occurring.

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.

Storing a configuration folder in game could work, that way it actually saves

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.

This is still an issue. Are there any updates?

1 Like

A year later, this is still an issue. Plugin data will seemingly vanish randomly without any overwrite or SetSetting call.

1 Like