Created
May 5, 2018 21:10
-
-
Save giljr/0b74a8ea6b4f74b7ddcd498168bb4142 to your computer and use it in GitHub Desktop.
Unity AdventureGame Totorial
This file contains hidden or 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; | |
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