var highlightColor = Color.red;
function OnMouseEnter () {
guiText.material.color = highlightColor;
transform.localScale (1.2, 1.2, 1.2);
}
function OnMouseExit () {
guiText.material.color = Color.white;
transform.localScale (1, 1, 1);
}
Gives an error about not invoking the vector 3 expression (in a function??). Can the text object be scaled in this manner?[/code]
That’s because localScale is not a function, but a variable of type Vector3.
What you want is:
var highlightColor = Color.red;
function OnMouseEnter () {
guiText.material.color = highlightColor;
transform.localScale = Vector3 (1.2, 1.2, 1.2);
}
function OnMouseExit () {
guiText.material.color = Color.white;
transform.localScale = Vector3 (1, 1, 1);
}
I.e. you create a Vector3 using the Vector3 (x, y, x) construct and then assign it to the localScale parameter using the assignment operator (=)
Excellent. And you’d then use the same method for position or rotation as well. Thanks, Keli!