Page 1 of 1

PlayerPrefs or other script variables as conditions?

Posted: Mon Apr 26, 2021 3:41 am
by olakehs
Hey Tony and everyone

I was wondering if someone knew how to set a condition via playerprefs? i.e. I have 2 nodes and would like to choose path A if PlayerPrefs.GetInt("Choice",1)

Thank you in advance for any advice
O

Re: PlayerPrefs or other script variables as conditions?

Posted: Mon Apr 26, 2021 10:07 am
by Tony Li
Hi,

You can write a C# method that returns the PlayerPrefs value. Example:

Code: Select all

double GetChoice() { return PlayerPrefs.GetInt("Choice", 1); }
Then register it with Lua so you can use it in conversations' Conditions fields: