Created
November 4, 2018 15:03
-
-
Save tsubaki/4d7153bd628a56f86b51deb8de3fe753 to your computer and use it in GitHub Desktop.
ボタンを押すたびに一行ずつ表示
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using UnityEngine; | |
public class Sample : MonoBehaviour | |
{ | |
[SerializeField] List<string> messages; | |
[SerializeField] UnityEngine.UI.Text messageBox; | |
private int current = 0; | |
private void Start() | |
{ | |
OnClick(); | |
} | |
public void OnClick() | |
{ | |
messageBox.text = messages[current]; | |
current = Mathf.Min(current + 1, messages.Count - 1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment