1

i wanted to show the tooltip like this when the mouse over at the object, here is the example image:

enter image description here

and

enter image description here

i already tried this below code, but the message on the debug.log didn't showed up when i am hovering my mouse to the object, the object i give the name same like this:

void Update() 
{

    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    RaycastHit hit;

    if (Physics.Raycast(ray,out hit) && hit.collider.gameObject.name == "Yify")
    {

        Debug.Log("Yify");

    }

}

And here is my object (i use List to multiple the objects and each object i gave the name), (The object's name "Yify" is on the right side, dark green color):

enter image description here

Please help. Thank you.

Kaoru
  • 2,853
  • 14
  • 34
  • 68

1 Answers1

0

This should work

void Update(){
        Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
        RaycastHit hit ;
        if (Physics.Raycast (ray, hit, 100.0) && hit.collider.gameObject.name=="Yify") {
          Debug.Log("Yify");
        }
    }
Dasu
  • 433
  • 6
  • 16
  • when the mouse is over the object (hovering the object), it will display or show the button on top of the hovering object. (e.g: like the second image that i mention in the question) – Kaoru Nov 29 '13 at 06:40