A New Medium for the Scrolling Marquee

“Letters in motion, you say? What a splendid invention.”
— Eustice P. McGargle

Recently when reminiscing about that custodian of excellent web design that is was GeoCities, I decided to give the <blink> and <marquee> tags a whirl, for old time’s sake. Alas, Safari refuses to recognize these bastions of 90s tastefulness. Tears splashed on my keyboard as I mourned the death of greatness.

And then a user on the Unity forums asked about scrolling text in-game, to which I enthusiastically responded. Browser manufacturers may have made every attempt to kill the non-standard HTML elements so thoughtfully introduced by Netscape and Microsoft, but they can’t take away these innovations from video games. Class will live on.

public string message = "Where we're going, we don't need roads.";
public float scrollSpeed = 50;

Rect messageRect;

void OnGUI () {
	// Set up message's rect if we haven't already
	if (messageRect.width == 0) {
		Vector2 dimensions = GUI.skin.label.CalcSize(new GUIContent(message));

		// Start message past left side of screen
		messageRect.x      = -dimensions.x;
		messageRect.width  =  dimensions.x;
		messageRect.height =  dimensions.y;
	}

	messageRect.x += Time.deltaTime * scrollSpeed;

	// If message has moved past right side, move it back to left
	if (messageRect.x > Screen.width) {
		messageRect.x = -messageRect.width;
	}

	GUI.Label(messageRect, message);
}

Stay tuned for blinking text in Unity, for even greater user enjoyment.

Posted on by Matthew Miner in Game Design, Website Creation 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>