From 703120b5b972e6c7804f9cddcc70a1a281449689 Mon Sep 17 00:00:00 2001 From: Simon Jackson Date: Sun, 9 Jul 2017 21:10:42 +0100 Subject: [PATCH] Minor TextPic updates while writing docs. Added individual scale and offset options to image replacements --- Scripts/Controls/TextPic.cs | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/Scripts/Controls/TextPic.cs b/Scripts/Controls/TextPic.cs index 8763f68..ec737ce 100644 --- a/Scripts/Controls/TextPic.cs +++ b/Scripts/Controls/TextPic.cs @@ -62,6 +62,13 @@ namespace UnityEngine.UI.Extensions { base.OnValidate(); UpdateQuadImage(); + for (int i = 0; i < inspectorIconList.Length; i++) + { + if (inspectorIconList[i].scale == Vector2.zero) + { + inspectorIconList[i].scale = Vector2.one; + } + } } #endif @@ -75,11 +82,12 @@ namespace UnityEngine.UI.Extensions { public string name; public Sprite sprite; + public Vector2 offset; + public Vector2 scale; } public IconName[] inspectorIconList; - private Dictionary iconList = new Dictionary(); - + [Tooltip("Global scaling factor for all images")] public float ImageScalingFactor = 1; // Write the name or hex value of the hyperlink color @@ -103,10 +111,7 @@ namespace UnityEngine.UI.Extensions private string previousText = ""; public bool isCreating_m_HrefInfos = true; - /** - * Unity Inspector cant display Dictionary vars, - * so we use this little hack to setup the iconList - */ + new void Start() { button = GetComponentInParent