Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created November 4, 2018 14:59
Show Gist options
  • Save tsubaki/fdf49e4f5eb52d5fe26d604557399dda to your computer and use it in GitHub Desktop.
Save tsubaki/fdf49e4f5eb52d5fe26d604557399dda to your computer and use it in GitHub Desktop.
文字列のリストから、ボタンを押すたびに一行ずつ取得
using System.Collections.Generic;
using UnityEngine;
public class Sample2 : MonoBehaviour
{
[SerializeField] List<string> messages;
[SerializeField] UnityEngine.UI.Text messageBox;
private List<string>.Enumerator enumerator;
void Start()
{
enumerator = messages.GetEnumerator();
OnClick();
}
public void OnClick()
{
if( enumerator.MoveNext())
messageBox.text = enumerator.Current;
}
}
@tsubaki
Copy link
Author

tsubaki commented Nov 4, 2018

137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment