Комментарии:
IMPORTANT: if your tooltip is flickering, turn off "Raycast Target" under "Image" of your Tooltip parent. Don't need to change the pivot at all.
ОтветитьThanks for a simple and clean implementation.
Unlike some other popular unity devs that take you on a rabbit hole of "custom components > needs download > sign up with email to download > news letters" vicious cycle.
would this work in a 3D game?
ОтветитьI tried clicking and dragging the pivot to the corner and it doesnt grab
ОтветитьFor those of you trying to use this on a Button instead of a GameObject the Tooltip Script would be different as shown below.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class Tooltip : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
public string message;
//=======================================For GameObjects==================
/*private void OnMouseEnter()
{
TooltipManager._instance.SetandShowToolTip(message);
}
private void OnMouseExit()
{
TooltipManager._instance.HideToolTip();
}*/
//=======================================For Buttons=========================
public void OnPointerEnter(PointerEventData pointerEventData)
{
TooltipManager._instance.SetandShowToolTip(message);
}
public void OnPointerExit(PointerEventData pointerEventData)
{
TooltipManager._instance.HideToolTip();
}
}
// This works 100%. Just set the Pivot correctly.
Congratulations! Very straight to the point. I've seen other tutorials that are too long because they spend too much time explaining how to make a fancy tooltip box. I prefer this one.
ОтветитьThis is excellent! So many uses, and gives the game a way to interact with the player. Thank you.
ОтветитьAny idea how to do this with visual scripting? I'm fairly new to this and have a hard time understanding the normal syntax layout of C#. I kind of know how to translate over but it's still pretty difficult and I can't figure this out
ОтветитьThanks.
ОтветитьI just spend hours trying to figure this out: the coin is a gameObject - NOT A UI ELEMENT. So I got that to work, but having trouble with figuring out how to tool tip the UI.
Thank anyhow.
Extremely useful, easy to follow, and easy to modify for any project. Thanks for this!
Ответить👍💎💎💎
ОтветитьHow do i stop the stuttering on the tooltip?
ОтветитьI didn't need a rigidbody component for this to work.
Ответитьwhat a fucking joke, who would want a tool tip that can't interact the UI elements.
ОтветитьHow would you make this work for button objects as well?
Ответитьthis didnt work for me.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class toolTipManager : MonoBehaviour
{
public static toolTipManager _instance;
public TextMeshProUGUI textComponent;
private void Awake()
{
if (_instance != null && _instance != this)
{
Destroy(this.gameObject);
}
else
{
_instance = this;
}
}
void Start()
{
Cursor.visible = true;
gameObject.SetActive(false);
}
void Update()
{
transform.position = Input.mousePosition;
}
public void SetAndShowToolTip(string message)
{
gameObject.SetActive(true);
textComponent.text = message;
}
public void HideToolTip()
{
gameObject.SetActive(false);
textComponent.text = string.Empty;
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class toolTip : MonoBehaviour
{
public string message;
private void OnMouseEnter()
{
toolTipManager._instance.SetAndShowToolTip(message);
}
private void OnMouseExit()
{
toolTipManager._instance.HideToolTip();
}
}
Amazing tutorial
ОтветитьBMO, impressive Tooltip box 😏
ОтветитьFinally a way to label all my spikey bois
ОтветитьHey this seems doable.
Gonna try it
Damn dude loving the flow of videos coming out, great work
ОтветитьI may have to use this someday..
Ответить