- Home /
How to increment button text from another scene?
Newbie question here. I have a shop scene in which I have a buy button. And a button and text counter in the Play scene. What should I do that when I press the buy button in the SHOP SCENE, it will increment the value to x1 of the button's text else it will not be interactable?
Help me please.
Answer by NeverHopeless · Jul 03, 2015 at 05:07 AM
Now it depends how you load the scene.
Application.LoadLevel
Using this way all the game scene gameobjects will be removed (except having DonntDestroyOnLoad). So you should better save this incremented value in PlayerPrefs and update it later, on loading game scene.
Application.LoadLevelAdditive
Using this way you have access to the text of the game scene objects. You can access them directly may be using GameObject.FindGameObjectWithTag()
and Set the Text
component's text.
You should better store it in PlayerPrefs
in both cases for use it on other scenes too (if there are).
Your answer
Follow this Question
Related Questions
Shop system isn’t working and I don’t know why 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How to create a shop system? 0 Answers
Problem with starting on screen keyboard windows c# 1 Answer