- Home /
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?
Answer by Waz · Aug 17, 2011 at 12:23 AM
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).