Skip to content

Commit

Permalink
Made deprecated components obsolete rather than just remove to reduce…
Browse files Browse the repository at this point in the history
… errors for upgrades
  • Loading branch information
SimonDarksideJ committed Nov 26, 2023
1 parent 162e4d3 commit 5eaf48d
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 32 deletions.
1 change: 0 additions & 1 deletion Runtime/Scripts/Controls/ComboBox/AutoCompleteComboBox.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
///Credit perchik
///Sourced from - http://forum.unity3d.com/threads/receive-onclick-event-and-pass-it-on-to-lower-ui-elements.293642/

using System;
using System.Collections.Generic;
using System.Linq;

Expand Down
13 changes: 11 additions & 2 deletions Runtime/Scripts/Effects/BestFitOutline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@
/// Sourced from - http://forum.unity3d.com/members/melang.593409/
/// NOT supported in Unity 2022

using System;
#if !UNITY_2022_1_OR_NEWER
using System.Collections.Generic;
#endif

namespace UnityEngine.UI.Extensions
{
#if UNITY_2022_1_OR_NEWER
[Obsolete("BestFitOutline is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
public class BestFitOutline : Shadow
{
}
#else
[AddComponentMenu("UI/Effects/Extensions/BestFit Outline")]
public class BestFitOutline : Shadow
{
Expand Down Expand Up @@ -61,5 +70,5 @@ public override void ModifyMesh (Mesh mesh)
}
}
}
}
#endif
#endif
}
18 changes: 13 additions & 5 deletions Runtime/Scripts/Effects/CurvedText.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
/// Credit Breyer
/// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/#post-1777407
#if !UNITY_2022_1_OR_NEWER

using System;

namespace UnityEngine.UI.Extensions
{
#if UNITY_2022_1_OR_NEWER
[Obsolete("CurvedText is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
public class CurvedText : BaseMeshEffect
{
public override void ModifyMesh(VertexHelper vh)
{
}
}
#else
[RequireComponent(typeof(Text))]
[RequireComponent(typeof(RectTransform))]
[AddComponentMenu("UI/Effects/Extensions/Curved Text")]
Expand Down Expand Up @@ -83,5 +91,5 @@ protected override void OnRectTransformDimensionsChange()
}
}
}
}
#endif
#endif
}
20 changes: 15 additions & 5 deletions Runtime/Scripts/Effects/CylinderText.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
/// adaption for cylindrical bending by herbst

using System;

/// adaption for cylindrical bending by herbst
/// Credit Breyer
/// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/#post-1777407
#if !UNITY_2022_1_OR_NEWER

namespace UnityEngine.UI.Extensions
{
#if UNITY_2022_1_OR_NEWER
[Obsolete("CylinderText is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
public class CylinderText : BaseMeshEffect
{
public override void ModifyMesh(VertexHelper vh)
{
}
}
#else
[RequireComponent(typeof(Text))]
[RequireComponent(typeof(RectTransform))]
[AddComponentMenu("UI/Effects/Extensions/Cylinder Text")]
Expand Down Expand Up @@ -53,5 +63,5 @@ public override void ModifyMesh(VertexHelper vh)
}
}
}
}
#endif
#endif
}
26 changes: 19 additions & 7 deletions Runtime/Scripts/Effects/LetterSpacing.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/// Credit Deeperbeige
/// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
/*
/*
Produces an simple tracking/letter-spacing effect on UI Text components.
Expand Down Expand Up @@ -42,9 +40,23 @@ This component doesn't really work with Rich Text. You don't need to remember to
*/
#if !UNITY_2022_1_OR_NEWER
using System.Collections.Generic;
#endif

using System;

/// Credit Deeperbeige
/// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
namespace UnityEngine.UI.Extensions
{
#if UNITY_2022_1_OR_NEWER
[Obsolete("LetterSpacing is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
public class LetterSpacing : BaseMeshEffect
{
public override void ModifyMesh(VertexHelper vh)
{
}
}
#else
[AddComponentMenu("UI/Effects/Extensions/Letter Spacing")]
///Summary
/// Note, Vertex Count has changed in 5.2.1+, is now 6 (two tris) instead of 4 (tri strip).
Expand All @@ -55,13 +67,13 @@ public class LetterSpacing : BaseMeshEffect

protected LetterSpacing() { }

#if UNITY_EDITOR
#if UNITY_EDITOR
protected override void OnValidate()
{
spacing = m_spacing;
base.OnValidate();
}
#endif
#endif

public float spacing
{
Expand Down Expand Up @@ -171,5 +183,5 @@ public override void ModifyMesh(VertexHelper vh)
vh.AddUIVertexTriangleStream(verts);
}
}
}
#endif
#endif
}
25 changes: 18 additions & 7 deletions Runtime/Scripts/Effects/MonoSpacing.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// Credit herbst / derived from LetterSpacing by Deeperbeige
/// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
/*
Produces an simple mono-spacing effect on UI Text components.
Expand Down Expand Up @@ -41,11 +39,24 @@ This component doesn't really work with Rich Text. You don't need to remember to
*/
#if !UNITY_2022_1_OR_NEWER

using System.Collections.Generic;
#endif

using System;

/// Credit herbst / derived from LetterSpacing by Deeperbeige
/// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
namespace UnityEngine.UI.Extensions
{
#if UNITY_2022_1_OR_NEWER
[Obsolete("MonoSpacing is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
public class MonoSpacing : BaseMeshEffect
{
public override void ModifyMesh(VertexHelper vh)
{
}
}
#else
[AddComponentMenu("UI/Effects/Extensions/Mono Spacing")]
[RequireComponent(typeof(Text))]
[RequireComponent(typeof(RectTransform))]
Expand Down Expand Up @@ -76,13 +87,13 @@ protected override void Awake()
rectTransform = text.GetComponent<RectTransform>();
}

#if UNITY_EDITOR
#if UNITY_EDITOR
protected override void OnValidate()
{
Spacing = m_spacing;
base.OnValidate();
}
#endif
#endif

public float Spacing
{
Expand Down Expand Up @@ -190,5 +201,5 @@ public override void ModifyMesh(VertexHelper vh)
vh.AddUIVertexTriangleStream(verts);
}
}
}
#endif
#endif
}
23 changes: 18 additions & 5 deletions Runtime/Scripts/Effects/NicerOutline.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@

#if !UNITY_2022_1_OR_NEWER
using System.Collections.Generic;
#endif

using System;

/// Credit Melang, Lee Hui
/// Sourced from - http://forum.unity3d.com/members/melang.593409/
/// GC Alloc fix - https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/pull-requests/130
/// NOT supported in Unity 2022

#if !UNITY_2022_1_OR_NEWER
using System.Collections.Generic;
namespace UnityEngine.UI.Extensions
{
#if UNITY_2022_1_OR_NEWER
[Obsolete("BestFitOutline is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
public class NicerOutline : BaseMeshEffect
{
public override void ModifyMesh(VertexHelper vh)
{
}
}
#else
//An outline that looks a bit nicer than the default one. It has less "holes" in the outline by drawing more copies of the effect
[AddComponentMenu("UI/Effects/Extensions/Nicer Outline")]
public class NicerOutline : BaseMeshEffect
Expand Down Expand Up @@ -194,5 +207,5 @@ protected override void OnValidate ()
}
#endif
}
}
#endif
#endif
}

0 comments on commit 5eaf48d

Please sign in to comment.