How to make a Tooltip (Unity Tutorial for Beginners)

preview_player
Показать описание
👍 Learn to make awesome games step-by-step from start to finish.
Let's create a Tooltip with a dynamic background that follows the mouse.

If you have any questions post them in the comments and I'll do my best to answer them.

See you next time!

#unity3d #tutorial #unity2d

--------------------------------------------------------------------

Hello and welcome, I am your Code Monkey and here you will learn everything about Game Development in Unity 2D using C#.

I've been developing games for several years with 7 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.

--------------------------------------------------------------------

Рекомендации по теме
Комментарии
Автор

🌐 Have you found the videos Helpful and Valuable?

CodeMonkeyUnity
Автор

Excellent work. I didn't follow the guide exactly as you laid out, but the end result I got was exactly what I wanted, and it's all thanks to this video for helping me along.

Gethin
Автор

For anyone using textmesh pro, instead of preferredWidth renderedWidth seems to work better and the Disable Raycast Target option is in the extra settings of the tmpro text object. hope this helps

btflp
Автор

I look up obscure things and you Always have something on it.

You truly are a gift and you need to know how appreciated you are.

papasherbert
Автор

Very interesting video, which is very useful to me. I was able to easily use this ToolTip on buttons generated at Runtime in an inventory. Thank you very much !

jean-michel.houbre
Автор

OK not gonna lie: The part with the static method blew my mind and absolutely helped me regarding any kind of 'prefab must do something'- issue.

I just didn't understand how prefabs can use anykind of existing GameObjects in the scene and yet the solution was very simple : static methods.


Thank you good sir!

JigJason
Автор

Hey, so whenever I start the game the tooltip just keeps ranodomising and doesen´t hide. it doesen´t even work when I hover over the button. I don´t know where to put the scripts as you haven´t showed that. It says Object reference not set to an instance of an object which there is a button called like that, I use both button and a button UI on the button thou.

Holsp
Автор

Very good tutorial, it helped me a lot, thanks :)

yangez
Автор

Hi again. I'm in a situation where I'm not using the Button_UI component from your utils. I've changed your script to the following, tapping straight into the IPointerEnterHandler and IPointerExitHandler, then defining the required methods (OnPointerEnter and OnPointerEnter) as showing and hiding the tooltip. Do you see any possible issue with this approach? (It occurred to me now that maybe that's how your Button_UI handles it in any case):
"public class AddTooltip : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler"

RecOgMission
Автор

Hi there,

I would like to make the tooltip change position and size to fit on the screen. For exemple when the tooltip appear near the edge of the canvas or that the text is too long, how can I detect that and make the tooltip appear for exemple on the other side of the mouse ?


Is there a build-in way or do I have to check manually the corners of the tooltip for exemple ?

harsismeor
Автор

ik you like doing the speed up thing, but people brand new can miss so many little edits you did to objects or scripts in that time and you dont say anything about it half the time. making people spend more time having to rewatch certain parts because you ninja changed a setting or rewrote a script

darksideskyy
Автор

1) Why we should use text on canvas instead of textmash?
2) How do you manage to layout elements within Canvas while Camera and Canvas visual size (in editor) is way different?

Awesome videos, I love them all :)

rickloyd
Автор

Thank you for this series, but could you maybe explain the construct of having a separate UI camera and screen space Camera instead of the Overlay? What are the benefits of such a construct?
And very stupid question, but when i load Unity Scene, the UI id distorted heavily (I guess some misconfiguration at my site) any idea if it has to do with the two different cameras?

Thx.

momusi.
Автор

I just got the position of the mouse instead. There's probably a better way of doing it but that's how I've done it for anyone interested.

Vector2 localPoint;
Vector3 offset = new Vector2(70, 0);
localPoint = Input.mousePosition;
transform.position = Input.mousePosition + offset;

PureEz
Автор

For anyone dealing with the flickering of text on hover problem make sure `Raycast target` is turned off

Keromaku
Автор

Would it not be better for each button to define its own tooltip?

JeffRusch
Автор

I know some people complain about the speed. But I like this video, quickly get to the point. :)

LeeTGame
Автор

tooltips still following the mouse on play with a bunch of random letters even after the window script bit im not sure why

genjivibes
Автор

Not the best solution with one class, that handles all tooltips.
What about separate component, that implements IPointerEnterHandler, IPointerExitHandler and has only one field with text, that need to be displayed as tooltip.

STARasGAMES
Автор

Very good tutorial was able to follow everything, I have a question why is the tooltip flashing on and off when hovering over the button?

zedgaming
join shbcf.ru