diff --git a/Assets/Fungus/Scripts/Editor/ViewEditor.cs b/Assets/Fungus/Scripts/Editor/ViewEditor.cs index 898c3d7ea..127465ef3 100644 --- a/Assets/Fungus/Scripts/Editor/ViewEditor.cs +++ b/Assets/Fungus/Scripts/Editor/ViewEditor.cs @@ -18,17 +18,13 @@ public class ViewEditor : Editor // Draw Views when they're not selected #if UNITY_5_0 - [DrawGizmo(GizmoType.NotSelected | GizmoType.SelectedOrChild)] + [DrawGizmo(GizmoType.NotSelected | GizmoType.SelectedOrChild, typeof(View))] #else - [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.InSelectionHierarchy)] + [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.InSelectionHierarchy, typeof(View))] #endif - static void RenderCustomGizmo(Transform objectTransform, GizmoType gizmoType) + public static void RenderCustomGizmo(View view, GizmoType gizmoType) { - View view = objectTransform.gameObject.GetComponent(); - if (view != null) - { - DrawView(view, false); - } + DrawView(view, false); } protected virtual Vector2 LookupAspectRatio(int index) @@ -264,4 +260,4 @@ static float CalculateLocalViewSize(View view) return view.transform.InverseTransformPoint(view.transform.position + new Vector3(0, view.ViewSize, 0)).magnitude; } } -} \ No newline at end of file +} diff --git a/Assets/Fungus/Scripts/Utils/TMProLinkAnimLookup.cs b/Assets/Fungus/Scripts/Utils/TMProLinkAnimLookup.cs index 8cb48985d..458f6aa30 100644 --- a/Assets/Fungus/Scripts/Utils/TMProLinkAnimLookup.cs +++ b/Assets/Fungus/Scripts/Utils/TMProLinkAnimLookup.cs @@ -81,17 +81,23 @@ public static class TMProLinkAnimLookup static public void AddHelper(string linkIdText, TMProAnimFunc func) { - LinkHashToEffect.Add(TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText), func); + var hashCode = TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText); + if(!LinkHashToEffect.ContainsKey(hashCode)) + LinkHashToEffect.Add(hashCode, func); } static public void AddHelper(string linkIdText, TMProLinkAnimEffects.BaseEffect baseEffect) { - LinkHashToEffect.Add(TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText), baseEffect.DoEffect); + var hashCode = TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText); + if (!LinkHashToEffect.ContainsKey(hashCode)) + LinkHashToEffect.Add(TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText), baseEffect.DoEffect); } static public void Remove(string linkIdText) { - LinkHashToEffect.Remove(TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText)); + var hashCode = TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText); + if (LinkHashToEffect.ContainsKey(hashCode)) + LinkHashToEffect.Remove(hashCode); } static public void RemoveAll() diff --git a/Assets/Fungus/Scripts/Utils/VariableUtil.cs b/Assets/Fungus/Scripts/Utils/VariableUtil.cs index 7744905b5..2b84a3345 100644 --- a/Assets/Fungus/Scripts/Utils/VariableUtil.cs +++ b/Assets/Fungus/Scripts/Utils/VariableUtil.cs @@ -65,8 +65,11 @@ public static string GetSetOperatorDescription(SetOperator setOperator) break; case SetOperator.Divide: - return "/="; - break; + //https://answers.unity.com/questions/398495/can-genericmenu-item-content-display-.html + // '/' in a menu means submenu and because it had no leading text, Unity thinks we want a spacer + // using unicode alternates for / fix the problem. + return "\u200A\u2215\u200A="; + break; } return string.Empty;