Blink Blink Blink

“Alternating visibility of letters, you say? What a splendid invention.”
— Eustice P. McGargle

As promised: a blinking text script for Unity, to bring back the glory days of Netscape Navigator. Sophistication starts here.

public float interval = 1;
bool visible = true;

void Start () {
	// Start blinking immediately
	TriggerBlink();
}

void OnGUI () {
	if (!visible) {
		// Set the GUI to be invisible
		GUI.color = Color.clear;
	}

	GUILayout.Label("History is gonna change.");
}

void TriggerBlink () {
	visible = !visible;
	// Continuous loop
	Invoke("TriggerBlink", interval);
}
Posted on by Matthew Miner in Game Design and tagged

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>