x


How to change renderer of another game object via interaction with another

Hello, everyone. Sorry for totally trivial question, I looked in the manual for a long time before coming here.

I want to create a 3d tooltip that'll appear when another object is hovered over. I've made the 3d text above the object and attached a script to it for invisibility:

function Start () {

renderer.material.color = Color.clear;

}

Now I want to use function OnMouseEnter () on the object in question to make the tooltip by simply changing its color. However, I cannot figure out how to specify the game object I need. I tried setting var with game object name, I tried GetObject, but none of it works, and I can't find the relevant bit in the manual anywhere. How do I specify that I need to change color of one object in the script of another?

more ▼

asked Aug 17 '11 at 12:08 AM

Gangrel gravatar image

Gangrel
1 1 1 1

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

http://unity3d.com/support/documentation/ScriptReference/index.Accessing_Other_Game_Objects.html

(it's the 4th section in the scripting docs, I'd recommend reading all sections).

more ▼

answered Aug 17 '11 at 12:23 AM

Waz gravatar image

Waz
6.5k 22 33 71

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3463
x2090
x508

asked: Aug 17 '11 at 12:08 AM

Seen: 703 times

Last Updated: Aug 17 '11 at 12:23 AM