It is something like the live demo in unity website, the demo in the room which you can drag the chairs and table. I want to highlight the gameobject when my mouse cursor move to it. which script should I use?
Link a disabled light to the gameobject
Then use ScreenPointToRay to cast a ray to it
something like that:
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray, hit, Mathf.Infinity))
{
hit.light.enabled=true;
}
iirc, in that demo the technique used was to change the color and/or material of the object with OnMouseOver. Something akin to the following.
function OnMouseOver () {
renderer.material.color = colorRed;
}
Here’s the documentation for it.
You can also download the actual project and see exactly how it’s done.
whoups
Yes, simpler ![]()
function OnMouseEnter () {
renderer.material.color = Color.red;
}