Weird PlayerPrefs value on single Android Device

Hi.
I’m currently developing a game for android where you can store your lives using “PlayerPrefs”

Right now I have a rudimental logic:
If there is a PlayerPrefs stored with the number of lives → set this number of lives at the beginning.
If there is no PlayerPrefs stored (lets assume the game is started for the very first time) → give the player 5 lives.

I have two phones: Huawei P30 Lite and Samsung Galaxy J3.

Installed game on both devices.
On Galaxy J3, the number of lives is setted default => 5
On Huawei, the number of lives is 8.= > Ok this is weird…

Entered the App settings from ANdroid, and cleared cache and data, now I get value 5, it seems ok.

Next thing I’ve did:

I put a message with UI Text in my if(PlayerPrefs.HasKey)
Built the app on Huawei and on Samsung again after I erased it and cleared all data.

Samsung J3: Displays the message: No playerprefs is loaded and number of lives 5
Huawei P30: Playerprefs is loaded and again this weird number 8 is stored.

Did anyone had this weird thing ?

Nope. And without code it is hard to even comment on it.

It’s almost certain that this is simply a bug in your logic that wrote an 8 to that value sometime, or else changed it to an 8 after reading it. Recheck your logic, print stuff out with Debug.Log() and I’m sure you can find it.

1 Like

Now it works, the only thing I did is changed the PlayerPrefs to a different name.

Weird part is that I don’t increment something that reaches 8 or value 8…and an all devices worked except my huawei.