Skip to main content
Commonmark migration
Source Link

i already have this player on my screen. And i want, whenever the mouse hover at the object, the GUI button show itself (like tooltip). I tried below code, but the button is not showed up when i hover at the object. Here is my code:

void OnMouseEnter()

    {

        Rect buttonRect = new Rect(250, Screen.height - buttonHeight, textInfoPlayerButtonWidth, textInfoPlayerButtonHeight);



        if (GameManager.instance.currentPlayerIndex == 0) (the object)

        {

            if (GUI.Button(buttonRect, "This is player 1"))

            {



            }

        }

    }

I want to be like this:

![enter image description here][1]enter image description here

But i want it to be show that GUI hovering button on that character, not when the character selected.

Thank you [1]: https://i.sstatic.net/huW01.jpg

i already have this player on my screen. And i want, whenever the mouse hover at the object, the GUI button show itself (like tooltip). I tried below code, but the button is not showed up when i hover at the object. Here is my code:

void OnMouseEnter()

    {

        Rect buttonRect = new Rect(250, Screen.height - buttonHeight, textInfoPlayerButtonWidth, textInfoPlayerButtonHeight);



        if (GameManager.instance.currentPlayerIndex == 0) (the object)

        {

            if (GUI.Button(buttonRect, "This is player 1"))

            {



            }

        }

    }

I want to be like this:

![enter image description here][1]

But i want it to be show that GUI hovering button on that character, not when the character selected.

Thank you [1]: https://i.sstatic.net/huW01.jpg

i already have this player on my screen. And i want, whenever the mouse hover at the object, the GUI button show itself (like tooltip). I tried below code, but the button is not showed up when i hover at the object. Here is my code:

void OnMouseEnter()

    {

        Rect buttonRect = new Rect(250, Screen.height - buttonHeight, textInfoPlayerButtonWidth, textInfoPlayerButtonHeight);



        if (GameManager.instance.currentPlayerIndex == 0) (the object)

        {

            if (GUI.Button(buttonRect, "This is player 1"))

            {



            }

        }

    }

I want to be like this:

enter image description here

But i want it to be show that GUI hovering button on that character, not when the character selected.

Thank you

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

Show the GUI button when mouse hover to the object

i already have this player on my screen. And i want, whenever the mouse hover at the object, the GUI button show itself (like tooltip). I tried below code, but the button is not showed up when i hover at the object. Here is my code:

void OnMouseEnter()

    {

        Rect buttonRect = new Rect(250, Screen.height - buttonHeight, textInfoPlayerButtonWidth, textInfoPlayerButtonHeight);



        if (GameManager.instance.currentPlayerIndex == 0) (the object)

        {

            if (GUI.Button(buttonRect, "This is player 1"))

            {



            }

        }

    }

I want to be like this:

![enter image description here][1]

But i want it to be show that GUI hovering button on that character, not when the character selected.

Thank you [1]: https://i.sstatic.net/huW01.jpg