Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Author
- /*
- Mobile Tooltip Systems is required for this component, it can be found
- on Unity's Asset Store at https://www.assetstore.unity3d.com/en/#!/content/36304
- Jones St. Lewis Cropper (caLLow)
- Another caLLowCreation
- Visit us on Google+ and other social media outlets @caLLowCreation
- Thanks for using our product.
- Send questions/comments/concerns/requests to
- e-mail: caLLowCreation@gmail.com
- subject: Mobile Tooltip Systems
- */
- #endregion
- using TooltipSystems.Scripts;
- using UnityEngine;
- using UnityEngine.EventSystems;
- namespace TooltipSystems
- {
- /// <summary>
- /// Requires a class derived from TooltipCoreUI
- /// <para>TooltipCoreUI is where TooltipCoreCanvas will look up text for the tooltip.</para>
- /// </summary>
- [AddComponentMenu("TooltipSystems/AddOns/ShowTooltipOnStart", 1)]
- [RequireComponent(typeof(TooltipBaseUI))]
- public class ShowTooltipOnStart : MonoBehaviour
- {
- [SerializeField]
- [Tooltip("Position pivot 0,0 is bottom left.")]
- Vector2 m_ShowPosition = new Vector2(10, 10);
- TooltipBaseUI m_Tooltip;
- //Awake is called when the script instance is being loaded.
- void Awake()
- {
- //Get the attached tooltip UI component
- m_Tooltip = GetComponent<TooltipBaseUI>();
- }
- //Start is called on the frame when a script is enabled just before any
- //of the Update methods is called the first time.
- void Start()
- {
- //Create a new pointer current event systen
- var pointerData = new PointerEventData(EventSystem.current);
- //Set the poistion for the tooltip
- //NOTE: Position pivot 0,0 is bottom left
- pointerData.position = m_ShowPosition;
- //Create a new tooltip event from Unity's pointer event
- var eventData = TooltipUIEventData.NotSet(pointerData);
- //Show the tooltipUI reference
- TooltipBaseCanvas.ShowTooltip(m_Tooltip, eventData);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement