I want to save the values entered by the user so that they are displayed the next time the user opens the application, without having to enter the values again. How should I do this?
You have several options :
- You could either save these settings to disk (
Serializethem) and read them again when your program starts (
- Or you could save them to a pin using the advanced
SaveToModelPinnode, which would save the settings in the patch directly.
In both cases I would first recommend create a
Record or a
Class that contains those settings, it’ll be easier to manage them!
I have made such attempts, but it can only save one value. When I want to save multiple values, there is a problem of value overwriting.
Not sure what you’re attempting there.
Workflow would be :
- On Create, look for a settings file (let’s say
- If found, deserialize it and make a Channel out of it
- If not found, create your
Settingsobject and make a Channel out of it
- When a user clicks a Save button, Serialize your
Settingsand write them to the
- Pass this Channel to your ImGUI editor and to your app
sebescudie,thank you, I found a Persistent Node, I will give it a try.
@sebescudie can you provide minimal example of
Still can’t figure out how it works and maybe a minimal example would be helpful
@Ice_snow I don’t think there’s a guaranteed successful way to do it right now. Everyone comes up with their own way. A lot of people are experimenting with Model/Runtime at the moment. I have a project that I usually do my projects with, but it’s a bit advanced.
SaveToModelPin.vl (28.0 KB)
There you go! Sorry for the delay. Hope this helps!
@sebescudie Thanks! Now it’s a lot more clear!
And as far as I understand, we have to manage the saving and loading of this state in exported applications ourselves?
Actually, it’s a pretty interesting concept. It turns out that any editing of the interface changes the patch itself and it has to be saved. In some cases it can be very convenient, and in some cases very inconvenient