Is there anyway to call on whenever a scene range loads after start to load a PlayerPrefs int key? I am new to programming so I have to ask. Of course, this is a feeble basic attempt at what I am asking just to give people an idea of the simplicity I am going for at maintaining an integer that PlayerPrefs stores that is added to a score with each button click and with each score added a new scene in a random range loads.
I have tried that, I do not think really that could be right, I wish it was, things would be so much easier. Because the score is a TMPro Text box that can only be visible within a canvas and not at the root of the scene where it needs to be for DontDestroyOnLoad to work, I just cannot find a work around for that, how much easier it would be if I could.
I think you’re just not understanding how to properly use DontDestroyOnLoad, so you’re trying to create work-arounds for it like using PlayerPrefs to store data. In your previous thread you said you called it on TMPro Text component, which doesn’t seem right. You need to use DontDestroyOnLoad on the top-level GUI hierarchy so the entire GUI is not destroyed during load.
That is a really nice idea, I will give that a study and see how I can expand my knowledge on static variables and see if I can pull this off. Thanks alot!
I figured it out and I was surprised by how simple it was from all that I tried and it was a simple implementation of player prefs get and set, where to start saving the key from and where and when to continue to call on it per update, as simple as two lines.