fungus

Open full view…

Can Fungus Pull Non-Fungus Keys From PlayerPrefs?

willoneill
Mon, 21 May 2018 05:15:54 GMT

I guess the subject line says it all...! I've basically got other things from other systems stored in PlayerPrefs keys that I'd like to be able to load into a Fungus variable. It doesn't seem to work and I'm thinking maybe there is a reason for it - I did notice that when I *save* a Fungus variable to a PlayerPrefs key, it adds an underscore to the beginning of it, so obviously it has some sort of way that it wants to traffic this stuff back and forth... Sorry if this question has been asked! It feels like an easy problem where I could be overlooking something simple... Thanks!

wolfrug
Mon, 21 May 2018 05:53:48 GMT

IIRC whenever you use the loadvariable/savevariable command, Fungus addends the current profile to the key automatically (to let you load/save into different "profiles" by default). This does have the effect of not letting you automagically load any playerprefs value. You could however quite easily create a custom command that just calls the default SetString/GetString (or whatever) PlayerPref commands for your own keys outside of Fungus. You might also be able to extend the save/load variable command to let you remove the added profile stuff and just load/save keys directly.

willoneill
Mon, 21 May 2018 16:57:05 GMT

Thanks as always, Wolfrug! I'm never going to need or save to more than the one profile, so the way that I solved this was to actually do it backwards - I redirected the *non*-Fungus systems to use the Fungus-created, underscore-appending key instead. If anyone else is seeing this and not planning to use more than one profile, this is probably a simpler option. A big 'ol find-and-replace through all of your scripts that changes the key name to what Fungus calls it and you should be all good. :)