X
X
xxxcocxxx2020-10-11 11:38:10
Unity
xxxcocxxx, 2020-10-11 11:38:10

How to make a page switcher in Unity?

I am making a text game (just starting to learn C#, UNITY). Let's say there are 5 pages of written text. You need to assign an index to each, and so that the next text is included on the "NextBttn" button. For example, there is a text with index 0, after I click the "Next" button, it is necessary that the text with index 1 appears, and the same thing, but in the opposite direction. How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MorganDusty, 2020-10-11
@xxxcocxxx

public class Example : MonoBehavior {
 
   private bool isFire2Active = false;
 
   public void Update() {
        isFire2Active = Input.GetButtonDown( "Fire2" );
   }
 
    // OnTriggerEnter будет срабатывать только 1 раз: когда только вошли в триггер
    public void OnTriggerStay2D( Collider2D other ) {
        if( other.tag == "Player" && isFire2Active ) {
            Debug.Log( "turn" );   
        }
    }
 
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question