using System.Collections;
///Credit Martin Nerurkar // www.martin.nerurkar.de // www.sharkbombs.com
///Sourced from - http://www.sharkbombs.com/2015/02/10/tooltips-with-the-new-unity-ui-ugui/
using UnityEngine.EventSystems;
namespace UnityEngine.UI.Extensions
{
[RequireComponent(typeof(RectTransform))]
[AddComponentMenu("UI/Extensions/Tooltip/Tooltip Trigger")]
public class TooltipTrigger : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, ISelectHandler, IDeselectHandler
{
[TextAreaAttribute]
public string text;
public enum TooltipPositioningType {
mousePosition,
mousePositionAndFollow,
transformPosition
}
[Tooltip("Defines where the tooltip will be placed and how that placement will occur. Transform position will always be used if this element wasn't selected via mouse")]
public TooltipPositioningType tooltipPositioningType = TooltipPositioningType.mousePosition;
///
/// This info is needed to make sure we make the necessary translations if the tooltip and this trigger are children of different space canvases
///
private bool isChildOfOverlayCanvas = false;
private bool hovered = false;
public Vector3 offset;
void Start() {
//attempt to check if our canvas is overlay or not and check our "is overlay" accordingly
Canvas ourCanvas = GetComponentInParent