Skip to content

Commit 452e649

Browse files
authored
Merge pull request #125 from arianfury008/patch-1
Remember ME
2 parents e029a51 + 2228df6 commit 452e649

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

Web3Unity/Scripts/Scenes/WalletLogin.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ public class WalletLogin: MonoBehaviour
1010

1111
void Start() {
1212
// if remember me is checked, set the account to the saved account
13-
if (rememberMe.isOn && PlayerPrefs.GetString("Account") != "")
13+
if(PlayerPrefs.HasKey("RememberMe") && PlayerPrefs.HasKey("Account"))
1414
{
15-
// move to next scene
16-
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
15+
if (PlayerPrefs.GetInt("RememberMe") == 1 && PlayerPrefs.GetString("Account") != "")
16+
{
17+
// move to next scene
18+
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
19+
}
1720
}
1821
}
1922

@@ -34,6 +37,11 @@ async public void OnLogin()
3437
if (account.Length == 42 && expirationTime >= now) {
3538
// save account
3639
PlayerPrefs.SetString("Account", account);
40+
if (rememberMe.isOn)
41+
PlayerPrefs.SetInt("RememberMe", 1);
42+
else
43+
PlayerPrefs.SetInt("RememberMe", 0);
44+
print("Account: " + account);
3745
// load next scene
3846
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
3947
}

0 commit comments

Comments
 (0)