Hello community
I’ve tried to work on UI for my project and everything works if I’m on the same scene.
However, if I change scene, my text-label for currency seems to dissapear and is not attached to a script as it initially was, due to the MissingReferenceException & my HP resets.
I’ve been trying to fiddle around with the following code and tried to only attach it to my EmptyObject that holds my UI, only the text and to my currency:
public static DontDestroy instance = null;
void Awake()
{
if (instance == null)
instance = this; else Destroy(transform.gameObject); DontDestroyOnLoad(transform.gameObject);
}
My approach has been that my FavorManager (which is the script for the currency, and holds the Text for display) always the script, just written for its proper class, and trying to put either the above script for each object seperately and simontaneously.
When I made my currency works as intended when changing scene, my HP would stop “tracking” and visa versa.
In the following link, it shows my Hierachy, my FavorManager, which hold the (pink) text and visual of my Screenshot by Lightshot.
I’m not sure what I should be looking for and hoped to get some guidance.
Kind regards
DaPham