/// Credit drobina, w34edrtfg, playemgames /// Sourced from - http://forum.unity3d.com/threads/sprite-icons-with-text-e-g-emoticons.265927/ using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; using UnityEngine.Events; using UnityEngine.EventSystems; namespace UnityEngine.UI.Extensions { // Image according to the label inside the name attribute to load, read from the Resources directory. The size of the image is controlled by the size property. // Use: public class TextPic : Text, IPointerClickHandler, IPointerExitHandler, IPointerEnterHandler, ISelectHandler { /// /// Image Pool /// private readonly List m_ImagesPool = new List(); /// /// Vertex Index /// private readonly List m_ImagesVertexIndex = new List(); /// /// Regular expression to replace /// private static readonly Regex s_Regex = new Regex(@"", RegexOptions.Singleline); private string fixedString; public override void SetVerticesDirty() { base.SetVerticesDirty(); UpdateQuadImage(); } /// /// After parsing the final text /// private string m_OutputText; [System.Serializable] public struct IconName { public string name; public Sprite sprite; } public IconName[] inspectorIconList; private Dictionary iconList = new Dictionary(); public float ImageScalingFactor = 1; // Write the name or hex value of the hyperlink color public string hyperlinkColor = "blue"; // Offset image by x, y [SerializeField] public Vector2 imageOffset = Vector2.zero; private Button button; //Commented out as private and not used.. Yet? //private bool selected = false; private List positions = new List(); /** * Unity Inspector cant display Dictionary vars, * so we use this little hack to setup the iconList */ new void Start() { button = GetComponent