Skip to content

Instantly share code, notes, and snippets.

@giljr
Created May 5, 2018 21:10
Show Gist options
  • Save giljr/0b74a8ea6b4f74b7ddcd498168bb4142 to your computer and use it in GitHub Desktop.
Save giljr/0b74a8ea6b4f74b7ddcd498168bb4142 to your computer and use it in GitHub Desktop.
Unity AdventureGame Totorial
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TheSimplestCoroutine : MonoBehaviour
{
void Start ()
{
string[] messages = { "Welcome", "to", "this", "amazing", "game!" };
StartCoroutine(PrintMessages(messages, .5f));
}
void Update()
{
}
IEnumerator PrintMessages(string[] messages, float delay)
{
foreach (string msg in messages)
{
print(msg);
yield return new WaitForSeconds(delay);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment