Skip to main content
added 189 characters in body
Source Link
Kaoru
  • 151
  • 1
  • 3

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

Please help. Thank you!

Update:

i already got the script that hold movement and attack logic like the image that shown below sir @Korchkidu:

enter image description here

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

Please help. Thank you!

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

Please help. Thank you!

Update:

i already got the script that hold movement and attack logic like the image that shown below sir @Korchkidu:

enter image description here

Tweeted twitter.com/#!/StackGameDev/status/405769806127038465
Source Link
Kaoru
  • 151
  • 1
  • 3

Show the tooltip when mouse over at the object unity3d

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

Please help. Thank you!