3D text change on click

Hey!

What I’m trying to figure out what to do, Is to make a script, that can change the 3D text when the left mouse button is pressed (See image below). It’s the introduction to a game, so basically it will be like this:

Hi!, I’m Flumar! Player clicks left mouse
More text Player clicks left mouse
More text Player clicks mouse
More text.

And so on.

I’ve attached a screenshot below to help explain what I mean.

Hopefully someone can help me out, or point me in the right direction.

Thanks!

3D text is from the TextMesh class. Assuming your script is attached to the TextMesh, you can change the text by:

GetComponent(TextMesh).text = "Some new text";

An array would be a good way to store your strings. If the array is public (the default in Javascript), you can assign the string in the Inspector. You can read more about the build-in arrays here:

http://docs.unity3d.com/Documentation/ScriptReference/Array.html

As for the mouse input, See Input.GetMouseButtonDown().