- Home /
how to display/copy a UI text from a different canvas/panel to another
so i have this UI text with numbers which is a timer and what i was trying to do was to copy that UI text that was save through a trigger and be displayed to another UI text from a different canvas/panel, but i dont know how, i tried using playerprefs it didnt work for me so is there any other way i can do it?
Answer by makled · May 10 at 11:36 AM
Hey, I would suggest that you save the timer value in a public variable in a singleton class that both the UI elements access. This way, you avoid copying data mid game (which for some reason, on runtime, the wrong data could be copied due to unexpected errors).
You can use a singleton design approach to make the data accessible across all scripts.
Check out this article to understand more about singletons: https://gamedevbeginner.com/singletons-in-unity-the-right-way/
thank you very much! its my first time really delving into singleton so thank you!
Your answer
