Answer the question
In order to leave comments, you need to log in
UNITY, I don’t know how to turn pages, didn’t find the information?
I want to create a text game, there are already panels, but I can’t do one moment. Let's say I have 2 pages, and 2 buttons are located (permanently). 1st "Next", 2nd "Back". It is necessary that when clicking on "Next" the next page is included, and, accordingly, on "Back" - the previous one. Of course, I can do it collectively, through SetActive, but then I will have to make 2 buttons on each page, which I don’t want to do at all. I roughly understand that you need to work with arrays and indices, but the information that I found is just code, without an elementary explanation, so nothing is clear.
Answer the question
In order to leave comments, you need to log in
You don't have to change screen every time you turn the page. All you need is to create a Text component on the screen, in the code, by pressing the "next" button, get this object from the screen using GetComponent<Text>()
, change its property .text
and resize the page after updating the content in accordance with the changed length of the component Text
.
Useful links:
Documentation on GameObject.GetComponent
Text component
Useful discussion on stackoverflow
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question