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?

Sorry I wasn’t clear enough. My solution fixes the issue where the idle plays for a brief moment (when you stop crouching, but decide to crouch again mid animation in your solution - this will cause idle animation to pop up for a brief moment until next Unity animation update.) Furthermore, the transition duration needs to be adjusted to get a nice blend in your transition.

1 Answer

1

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).