mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-20 01:42:37 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bbb1f965fd | |||
| b778d02131 | |||
| 365c43e21d |
@@ -9,7 +9,7 @@ env:
|
||||
# MINIMUM_VERSION: The minimum version of Unity.
|
||||
MINIMUM_VERSION: 2020.3
|
||||
# EXCLUDE_FILTER: The excluded versions of Unity.
|
||||
EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.3)"
|
||||
EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.2|2023.3)"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
## [5.3.4](https://github.com/mob-sakai/UIEffect/compare/5.3.3...5.3.4) (2025-02-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* UIEffect v5.3.3 with TextMeshPro is not working in play mode in editor ([365c43e](https://github.com/mob-sakai/UIEffect/commit/365c43e21dcaaff349cf1362f9bd25b7deb163f7)), closes [#306](https://github.com/mob-sakai/UIEffect/issues/306)
|
||||
|
||||
## [5.3.3](https://github.com/mob-sakai/UIEffect/compare/5.3.2...5.3.3) (2025-02-06)
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
@@ -54,9 +55,9 @@ namespace Coffee.UIEffects
|
||||
|
||||
public override void SetVerticesDirty(Graphic graphic)
|
||||
{
|
||||
if (graphic is TextMeshProUGUI textMeshProUGUI)
|
||||
if (graphic is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
|
||||
{
|
||||
s_ChangedInstances.Add(textMeshProUGUI);
|
||||
OnChangeText(textMeshProUGUI);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,11 +108,13 @@ namespace Coffee.UIEffects
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[InitializeOnLoadMethod]
|
||||
#else
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
#endif
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
private static void InitializeOnLoad()
|
||||
{
|
||||
s_ChangedInstances.Clear();
|
||||
s_RegisteredInstances.Clear();
|
||||
s_SdfScaleCache.Clear();
|
||||
Register(new TmpProxy());
|
||||
|
||||
// When the text is changed, add it to the changed list
|
||||
@@ -129,16 +132,15 @@ namespace Coffee.UIEffects
|
||||
var toRemove = InternalListPool<TextMeshProUGUI>.Rent();
|
||||
foreach (var textMeshProUGUI in s_RegisteredInstances)
|
||||
{
|
||||
if (textMeshProUGUI)
|
||||
if (textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
|
||||
{
|
||||
var id = textMeshProUGUI.GetHashCode();
|
||||
var lossyScaleY = textMeshProUGUI.transform.lossyScale.y;
|
||||
|
||||
// If the scale has changed, add to the changed list
|
||||
if (s_SdfScaleCache.TryGetValue(id, out var prev)
|
||||
&& !Mathf.Approximately(prev, lossyScaleY))
|
||||
if (s_SdfScaleCache.TryGetValue(id, out var prev) && !Mathf.Approximately(prev, lossyScaleY))
|
||||
{
|
||||
s_ChangedInstances.Add(textMeshProUGUI);
|
||||
OnChangeText(textMeshProUGUI);
|
||||
}
|
||||
|
||||
// Update the scale cache
|
||||
@@ -157,6 +159,8 @@ namespace Coffee.UIEffects
|
||||
s_SdfScaleCache.Remove(textMeshProUGUI.GetHashCode());
|
||||
s_RegisteredInstances.Remove(textMeshProUGUI);
|
||||
}
|
||||
|
||||
InternalListPool<TextMeshProUGUI>.Return(ref toRemove);
|
||||
};
|
||||
|
||||
// Modify the changed TMP mesh
|
||||
@@ -172,6 +176,14 @@ namespace Coffee.UIEffects
|
||||
};
|
||||
}
|
||||
|
||||
private static void OnChangeText(Object obj)
|
||||
{
|
||||
if (obj is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
|
||||
{
|
||||
s_ChangedInstances.Add(textMeshProUGUI);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ModifyMesh(TextMeshProUGUI textMeshProUGUI)
|
||||
{
|
||||
if (!textMeshProUGUI.TryGetComponent<UIEffectBase>(out var effect)) return;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "com.coffee.ui-effect",
|
||||
"displayName": "UI Effect",
|
||||
"description": "UIEffect is an open-source package that allows you to intuitively apply rich UI effects directly from the Inspector or via code.\nCombine various filters, such as grayscale, blur, and dissolve, to decorate your UI with a unique visual style!",
|
||||
"version": "5.3.3",
|
||||
"version": "5.3.4",
|
||||
"unity": "2020.3",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user