#Playerprefs not working right

1 messages · Page 1 of 1 (latest)

remote wharf
#

I have a problem in a Unity project that im developing. I can't make the new values to be saved and used later at the same scene (it goes from this scene (shop) to another scene to then come back to the first scene (shop). Basically, I buy upgrades from a shop until it's "max", then, when I come back to this scene, the value is at level 1 (even though I already have the lvl max and I can't buy more because I have it at max lvl).

The images are all the code that I used. I've tried using playerprefs to save the new values, but it simply doesn't work. (I highlight the playerprefs code that I tried to use bit it didn't work).

If someone could help me it would be very nice, I have to finish this by next week 🥲😓.

#

I will send the pictures right in a moment

lethal dew
#

try JPEG

grizzled hull
#

Do not send screenshots of code, specially not taken like that. It's unreadable. Send code like shown in the #📄・posting-guidelines

remote wharf
#

okok srry

#

This is my current code (i added the OnDestroy function and it still doesn't work):

#

Omg I didn't know that this format was possible 😮

#

There are some "//" parts in spanish, just for you to know

blissful surge
#

@remote wharf check if onDestroy function works first

remote wharf
#

It does I think

#

I'm not very good at this so I will ask basic questions

blissful surge
#

like check if you can even print something out in the destroy function

remote wharf
#

Like: debug.Log?

blissful surge
#

yeah

#

any updates?

remote wharf
#

I didn't have time, I'll let you know when I do

remote wharf
#

It resets both values to 1 and 10