Instantly share code, notes, and snippets.

Embed
What would you like to do?
文字列のリストから、ボタンを押すたびに一行ずつ取得
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

This comment has been minimized.

Owner

tsubaki commented Nov 4, 2018

137

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