Printing to console

Hey everyone,

I’m playing with the rock paper scissors example found here: http://unifycommunity.com/wiki/index.php?title=Programming_Chapter_2_Old#Code_-_Relational_Operators and want to add a line that prints which button was clicked to the console.

I’m new to Javascript and pretty bad at deciphering code but I think the best place to put the line would be here in the TextButton script:

function OnMouseUp ()
{
    isPressed = false;
    manager.OnSelection(guiText.text);
}

if I’m correct this is where the player’s selection is made and sent to the manager where the string interpreted as a rock paper or scissor. What I don’t know is how to get that string to print using Debug.Log or Print. Any help is appreciated!

Debug.Log

I’m not 100% sure since I’ve never looked at that example project, but you can try this.

Debug.Log(guiText.text);

Sweet! it worked! Thank you!

Now how do I append more text to that? The console doesn’t like it if I try to do anything like Debug.Log (guiText.text, "was clicked).

Also, Megadeth does rock! \m/

Debug.Log(text1 + text2);

FYI, if you’re new to scripting in general, you might want to start here:

http://forum.unity3d.com/threads/34015-Newbie-guide-to-Unity-Javascript-(long)

Thanks everyone!

tonyd I’m going to take a look at your thread.