Compare commits

...

16 Commits

Author SHA1 Message Date
semantic-release-bot 6f90044ec8 chore(release): 5.9.6 [skip ci]
## [5.9.6](https://github.com/mob-sakai/UIEffect/compare/5.9.5...5.9.6) (2025-07-17)

### Bug Fixes

* `ColorFilter` does not output intended color when vertex color is not white ([9dffdb0](https://github.com/mob-sakai/UIEffect/commit/9dffdb0ed88750a915fdd5e437b79ab766ce45c2)), closes [#363](https://github.com/mob-sakai/UIEffect/issues/363)
* draw calls increase even when using `UIEffectReplica` ([83128eb](https://github.com/mob-sakai/UIEffect/commit/83128ebb09305e4c15a58968a94550179e96ffac)), closes [#364](https://github.com/mob-sakai/UIEffect/issues/364)
2025-07-17 10:23:05 +00:00
mob-sakai 83128ebb09 fix: draw calls increase even when using UIEffectReplica
The `UIEffectReplica` component reuses materials as much as possible without creating new ones.
close #364
2025-07-17 19:17:15 +09:00
mob-sakai 9dffdb0ed8 fix: ColorFilter does not output intended color when vertex color is not white
close #363
2025-07-09 20:03:24 +09:00
semantic-release-bot 16be53e145 chore(release): 5.9.5 [skip ci]
## [5.9.5](https://github.com/mob-sakai/UIEffect/compare/5.9.4...5.9.5) (2025-06-26)

### Bug Fixes

* `GetGradientKeys` and `GetTransitionGradientKeys` cannot get GradientMode ([fd2d1b8](https://github.com/mob-sakai/UIEffect/commit/fd2d1b80592ac4ea62e15b6150be63964b113fa2)), closes [#358](https://github.com/mob-sakai/UIEffect/issues/358)
2025-06-26 07:26:57 +00:00
mob-sakai fd2d1b8059 fix: GetGradientKeys and GetTransitionGradientKeys cannot get GradientMode
close #358
2025-06-26 16:25:24 +09:00
semantic-release-bot cf43bfffb9 chore(release): 5.9.4 [skip ci]
## [5.9.4](https://github.com/mob-sakai/UIEffect/compare/5.9.3...5.9.4) (2025-06-25)

### Bug Fixes

* colors specified in UIEffect are output differently in linear color space ([0d7fb1e](https://github.com/mob-sakai/UIEffect/commit/0d7fb1eb63881b67f2658567750a83c92187df35)), closes [#359](https://github.com/mob-sakai/UIEffect/issues/359)
2025-06-25 23:17:34 +00:00
mob-sakai a2f4a2d5c9 refactor 2025-06-26 08:13:17 +09:00
mob-sakai 0d7fb1eb63 fix: colors specified in UIEffect are output differently in linear color space
close #359
2025-06-26 08:11:21 +09:00
semantic-release-bot 145f56968a chore(release): 5.9.3 [skip ci]
## [5.9.3](https://github.com/mob-sakai/UIEffect/compare/5.9.2...5.9.3) (2025-06-23)

### Bug Fixes

* add `GetGradientKeys` and `GetTransitionGradientKeys` APIs ([a0c3e49](https://github.com/mob-sakai/UIEffect/commit/a0c3e4997af181ae16744c53ad3867e2106ccff3)), closes [#358](https://github.com/mob-sakai/UIEffect/issues/358)
* support world canvas without UI events ([cadbb8d](https://github.com/mob-sakai/UIEffect/commit/cadbb8d68d17a2ec7e2d6e8e885d711e61fa53af)), closes [#356](https://github.com/mob-sakai/UIEffect/issues/356) [#357](https://github.com/mob-sakai/UIEffect/issues/357)
2025-06-23 09:29:53 +00:00
mob-sakai cadbb8d68d fix: support world canvas without UI events
close #356, close #357
2025-06-23 18:15:58 +09:00
mob-sakai a0c3e4997a fix: add GetGradientKeys and GetTransitionGradientKeys APIs
close #358
2025-06-23 18:15:08 +09:00
semantic-release-bot ec57c2a994 chore(release): 5.9.2 [skip ci]
## [5.9.2](https://github.com/mob-sakai/UIEffect/compare/5.9.1...5.9.2) (2025-06-12)

### Bug Fixes

* TextMeshPro 3.2.0-pre support ([804b48c](https://github.com/mob-sakai/UIEffect/commit/804b48c73ec648eaceb720cb79551fdbf3729fc9)), closes [#355](https://github.com/mob-sakai/UIEffect/issues/355)
2025-06-12 11:51:05 +00:00
mob-sakai 804b48c73e fix: TextMeshPro 3.2.0-pre support
close #355
2025-06-12 20:49:32 +09:00
semantic-release-bot 01be18bb28 chore(release): 5.9.1 [skip ci]
## [5.9.1](https://github.com/mob-sakai/UIEffect/compare/5.9.0...5.9.1) (2025-06-11)

### Bug Fixes

* prefabs will be deselected when editing them ([8addbad](https://github.com/mob-sakai/UIEffect/commit/8addbad4941340807d824e295280473d197d889f)), closes [#354](https://github.com/mob-sakai/UIEffect/issues/354)
2025-06-11 09:15:00 +00:00
mob-sakai 8addbad494 fix: prefabs will be deselected when editing them
close #354
2025-06-11 18:11:58 +09:00
mob-sakai dc5b3805d7 docs: update readme 2025-06-09 20:12:33 +09:00
15 changed files with 131 additions and 95 deletions
+44
View File
@@ -1,3 +1,47 @@
## [5.9.6](https://github.com/mob-sakai/UIEffect/compare/5.9.5...5.9.6) (2025-07-17)
### Bug Fixes
* `ColorFilter` does not output intended color when vertex color is not white ([9dffdb0](https://github.com/mob-sakai/UIEffect/commit/9dffdb0ed88750a915fdd5e437b79ab766ce45c2)), closes [#363](https://github.com/mob-sakai/UIEffect/issues/363)
* draw calls increase even when using `UIEffectReplica` ([83128eb](https://github.com/mob-sakai/UIEffect/commit/83128ebb09305e4c15a58968a94550179e96ffac)), closes [#364](https://github.com/mob-sakai/UIEffect/issues/364)
## [5.9.5](https://github.com/mob-sakai/UIEffect/compare/5.9.4...5.9.5) (2025-06-26)
### Bug Fixes
* `GetGradientKeys` and `GetTransitionGradientKeys` cannot get GradientMode ([fd2d1b8](https://github.com/mob-sakai/UIEffect/commit/fd2d1b80592ac4ea62e15b6150be63964b113fa2)), closes [#358](https://github.com/mob-sakai/UIEffect/issues/358)
## [5.9.4](https://github.com/mob-sakai/UIEffect/compare/5.9.3...5.9.4) (2025-06-25)
### Bug Fixes
* colors specified in UIEffect are output differently in linear color space ([0d7fb1e](https://github.com/mob-sakai/UIEffect/commit/0d7fb1eb63881b67f2658567750a83c92187df35)), closes [#359](https://github.com/mob-sakai/UIEffect/issues/359)
## [5.9.3](https://github.com/mob-sakai/UIEffect/compare/5.9.2...5.9.3) (2025-06-23)
### Bug Fixes
* add `GetGradientKeys` and `GetTransitionGradientKeys` APIs ([a0c3e49](https://github.com/mob-sakai/UIEffect/commit/a0c3e4997af181ae16744c53ad3867e2106ccff3)), closes [#358](https://github.com/mob-sakai/UIEffect/issues/358)
* support world canvas without UI events ([cadbb8d](https://github.com/mob-sakai/UIEffect/commit/cadbb8d68d17a2ec7e2d6e8e885d711e61fa53af)), closes [#356](https://github.com/mob-sakai/UIEffect/issues/356) [#357](https://github.com/mob-sakai/UIEffect/issues/357)
## [5.9.2](https://github.com/mob-sakai/UIEffect/compare/5.9.1...5.9.2) (2025-06-12)
### Bug Fixes
* TextMeshPro 3.2.0-pre support ([804b48c](https://github.com/mob-sakai/UIEffect/commit/804b48c73ec648eaceb720cb79551fdbf3729fc9)), closes [#355](https://github.com/mob-sakai/UIEffect/issues/355)
## [5.9.1](https://github.com/mob-sakai/UIEffect/compare/5.9.0...5.9.1) (2025-06-11)
### Bug Fixes
* prefabs will be deselected when editing them ([8addbad](https://github.com/mob-sakai/UIEffect/commit/8addbad4941340807d824e295280473d197d889f)), closes [#354](https://github.com/mob-sakai/UIEffect/issues/354)
# [5.9.0](https://github.com/mob-sakai/UIEffect/compare/5.8.7...5.9.0) (2025-06-09)
+2 -2
View File
@@ -269,7 +269,7 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-transition.png)
- **Transition Filter**: `None`, `Fade`, `Cutoff`, `Dissolve`, `Shiny`, `Mask`, `Melt`, `Burn`, `Blaze`, `Pattern`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1749461050342.png)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1749466907712.gif)
- **Transition Rate**: 0.0 (no effect) - 1.0 (full effect).
- **Transition Tex**: The texture used for the transition filter.
- **Scale**, **Offset**, **Speed**, **Rotation**, **Keep Aspect Ratio**, **Reverse**: Additional properties for the texture.
@@ -339,7 +339,7 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744305109784.png)
- **Gradation Mode**: `None`, `Horizontal`, `HorizontalGradient`, `Vertical`, `VerticalGradient`, `Radial`, `RadialGradient`, `Diagonal`, `DiagonalToRightBottom`, `DiagonalToLeftBottom`, `Angle`, `AngleGradient`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1749460950217.png)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1749461050342.png)
- **Gradation Color Filter**: `None`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `Multiply Luminance`, `Multiply Additive`
- **Gradation Gradient**: The gradient of the gradation. HDR colors are supported.
- `Blend` and `Fixed` modes are available.
@@ -27,6 +27,11 @@
"name": "com.unity.timeline",
"expression": "1.0.0",
"define": "TIMELINE_ENABLE"
},
{
"name": "com.unity.textmeshpro",
"expression": "[1.0.0,3.2.0-pre.1)",
"define": "LEGACY_TMP_ENABLE"
}
],
"noEngineReferences": false
+2
View File
@@ -112,8 +112,10 @@ namespace Coffee.UIEffects
Vertical = 3,
VerticalGradient = 4,
Radial = 5,
[Obsolete]
RadialFast = 5,
[Obsolete]
RadialDetail = 6,
RadialGradient = 12,
@@ -20,16 +20,18 @@ namespace Coffee.UIEffectInternal
UpdateTmpCgincPath();
}
private static void OnPostprocessAllAssets(string[] _, string[] __, string[] ___, string[] ____)
private static void OnPostprocessAllAssets(string[] imported, string[] __, string[] ___, string[] ____)
{
UpdateTmpCgincPath();
if (imported.Any(x => x.EndsWith(".cginc") || x.EndsWith(".shader")))
{
UpdateTmpCgincPath();
}
}
private static void UpdateTmpCgincPath()
{
if (s_CgincPattern == null || s_ShaderNames == null || s_ShaderNames.Length == 0) return;
AssetDatabase.StartAssetEditing();
string[] cgincs = null;
foreach (var shaderName in s_ShaderNames)
{
@@ -47,8 +49,6 @@ namespace Coffee.UIEffectInternal
UpdateTmpCgincPath(shader, cgincs);
}
AssetDatabase.StopAssetEditing();
}
private static void UpdateTmpCgincPath(Shader shader, string[] cgincs)
@@ -1,53 +0,0 @@
// #if TIMELINE_ENABLE
// using System;
// using System.ComponentModel;
// using UnityEngine;
//
// namespace Coffee.UIEffects.Timeline
// {
// [DisplayName("Clip")]
// public class UIEffectFloat01Clip : UIEffectClip<UIEffectFloatBehaviour>
// {
// }
//
// // [Serializable]
// // public class UIEffectFloat01Behaviour : UIEffectFloatBehaviour
// // {
// // [Range(0, 1)]
// // public float m_Value = 1;
// //
// // [Range(0, 1)]
// // public float m_From = 1;
// //
// // protected override float from => m_From;
// // protected override float value => m_Value;
// // }
//
// // public class UIEffectFloatBehaviour : UIEffectBehaviour, IGetValue<float>
// // {
// // protected virtual float value { get; }
// // protected virtual float from { get; }
// //
// // public float Get(float time)
// // {
// // return m_Tween
// // ? Mathf.Lerp(from, value, m_Curve.Evaluate(time))
// // : value;
// // }
// // }
// //
// // public abstract class UIEffectFloatMixerBehaviour : UIEffectMixerBehaviour<float, UIEffectFloatBehaviour>
// // {
// // protected override float Add(float baseValue, float value, float weight)
// // {
// // return baseValue + value * weight;
// // }
// //
// // protected override float Lerp(float defaultValue, float value, float weight)
// // {
// // return Mathf.Lerp(defaultValue, value, weight);
// // }
// // }
// }
//
// #endif
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: deea59e7cd34449c89e7c1f6438a5392
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -76,7 +76,6 @@ namespace Coffee.UIEffects.Timeline
private void OnValidate()
{
}
}
+22
View File
@@ -1519,6 +1519,17 @@ namespace Coffee.UIEffects
SetGradientKeys(gradient.colorKeys, gradient.alphaKeys, gradient.mode);
}
/// <summary>
/// Get gradation gradient's keys.
/// </summary>
public void GetGradientKeys(out GradientColorKey[] colorKeys, out GradientAlphaKey[] alphaKeys,
out GradientMode mode)
{
colorKeys = m_GradationGradient?.colorKeys ?? Array.Empty<GradientColorKey>();
alphaKeys = m_GradationGradient?.alphaKeys ?? Array.Empty<GradientAlphaKey>();
mode = m_GradationGradient?.mode ?? GradientMode.Blend;
}
/// <summary>
/// Set transition gradient's keys.
/// </summary>
@@ -1527,6 +1538,17 @@ namespace Coffee.UIEffects
SetTransitionGradientKeys(gradient.colorKeys, gradient.alphaKeys, gradient.mode);
}
/// <summary>
/// Get transition gradation gradient's keys.
/// </summary>
public void GetTransitionGradientKeys(out GradientColorKey[] colorKeys, out GradientAlphaKey[] alphaKeys,
out GradientMode mode)
{
colorKeys = m_TransitionGradient?.colorKeys ?? Array.Empty<GradientColorKey>();
alphaKeys = m_TransitionGradient?.alphaKeys ?? Array.Empty<GradientAlphaKey>();
mode = m_TransitionGradient?.mode ?? GradientMode.Blend;
}
/// <summary>
/// Set gradation gradient's keys.
/// </summary>
+1 -1
View File
@@ -19,7 +19,7 @@ namespace Coffee.UIEffects
[DisallowMultipleComponent]
public abstract class UIEffectBase : UIBehaviour, IMeshModifier, IMaterialModifier, ICanvasRaycastFilter
#if TIMELINE_ENABLE
,ITimeControl
, ITimeControl
#endif
{
private static readonly InternalObjectPool<UIEffectContext> s_ContextPool =
+22 -13
View File
@@ -294,7 +294,7 @@ namespace Coffee.UIEffects
{
var x = m_GradationReverse ? w - 1 - i : i;
var t = (float)i / (w - 1);
s_Colors[x] = m_GradationGradient.Evaluate(t);
s_Colors[x] = ApplyColorSpace(m_GradationGradient.Evaluate(t));
}
_gradationRampTex.wrapMode = m_GradationWrapMode;
@@ -320,7 +320,7 @@ namespace Coffee.UIEffects
for (var i = 0; i < w; i++)
{
var t = (float)i / (w - 1);
s_Colors[i] = m_TransitionGradient.Evaluate(t);
s_Colors[i] = ApplyColorSpace(m_TransitionGradient.Evaluate(t));
}
s_Colors[w - 1].a = 0;
@@ -454,7 +454,7 @@ namespace Coffee.UIEffects
material.SetFloat(s_ToneIntensity, Mathf.Clamp01(m_ToneIntensity));
material.SetInt(s_ColorFilter, (int)m_ColorFilter);
material.SetColor(s_ColorValue, m_Color);
material.SetColor(s_ColorValue, ApplyColorSpace(m_Color));
material.SetFloat(s_ColorIntensity, Mathf.Clamp01(m_ColorIntensity));
material.SetInt(s_ColorGlow, m_ColorGlow ? 1 : 0);
@@ -473,14 +473,14 @@ namespace Coffee.UIEffects
material.SetFloat(s_TransitionSoftness, Mathf.Clamp01(m_TransitionSoftness));
material.SetVector(s_TransitionRange, new Vector2(m_TransitionRange.min, m_TransitionRange.max));
material.SetInt(s_TransitionColorFilter, (int)m_TransitionColorFilter);
material.SetColor(s_TransitionColor, m_TransitionColor);
material.SetColor(s_TransitionColor, ApplyColorSpace(m_TransitionColor));
material.SetInt(s_TransitionColorGlow, m_TransitionColorGlow ? 1 : 0);
material.SetInt(s_TransitionPatternReverse, m_TransitionPatternReverse ? 1 : 0);
material.SetFloat(s_TransitionAutoPlaySpeed, m_TransitionAutoPlaySpeed);
material.SetTexture(s_TransitionGradientTex,
m_TransitionFilter == TransitionFilter.Blaze ? transitionRampTex : null);
material.SetColor(s_TargetColor, m_TargetColor);
material.SetColor(s_TargetColor, ApplyColorSpace(m_TargetColor));
material.SetFloat(s_TargetRange, Mathf.Clamp01(m_TargetRange));
material.SetFloat(s_TargetSoftness, Mathf.Clamp01(m_TargetSoftness));
@@ -497,12 +497,12 @@ namespace Coffee.UIEffects
}
material.SetInt(s_ShadowColorFilter, (int)m_ShadowColorFilter);
material.SetColor(s_ShadowColor, m_ShadowColor);
material.SetColor(s_ShadowColor, ApplyColorSpace(m_ShadowColor));
material.SetInt(s_ShadowColorGlow, m_ShadowColorGlow ? 1 : 0);
material.SetFloat(s_EdgeWidth, Mathf.Clamp01(m_EdgeWidth));
material.SetInt(s_EdgeColorFilter, (int)m_EdgeColorFilter);
material.SetColor(s_EdgeColor, m_EdgeColor);
material.SetColor(s_EdgeColor, ApplyColorSpace(m_EdgeColor));
material.SetInt(s_EdgeColorGlow, m_EdgeColorGlow ? 1 : 0);
material.SetFloat(s_EdgeShinyRate, Mathf.Clamp01(m_EdgeShinyRate));
material.SetFloat(s_EdgeShinyWidth, Mathf.Clamp01(m_EdgeShinyWidth));
@@ -514,10 +514,10 @@ namespace Coffee.UIEffects
material.SetFloat(s_GradationIntensity, m_GradationIntensity);
material.SetInt(s_GradationColorFilter, (int)m_GradationColorFilter);
material.SetColor(s_GradationColor1, m_GradationColor1);
material.SetColor(s_GradationColor2, m_GradationColor2);
material.SetColor(s_GradationColor3, m_GradationColor3);
material.SetColor(s_GradationColor4, m_GradationColor4);
material.SetColor(s_GradationColor1, ApplyColorSpace(m_GradationColor1));
material.SetColor(s_GradationColor2, ApplyColorSpace(m_GradationColor2));
material.SetColor(s_GradationColor3, ApplyColorSpace(m_GradationColor3));
material.SetColor(s_GradationColor4, ApplyColorSpace(m_GradationColor4));
material.SetInt(s_GradationRadial, m_GradationMode == GradationMode.Radial
#pragma warning disable CS0612 // Type or member is obsolete
|| m_GradationMode == GradationMode.RadialDetail
@@ -525,7 +525,7 @@ namespace Coffee.UIEffects
|| m_GradationMode == GradationMode.RadialGradient ? 1 : 0);
material.SetFloat(s_DetailIntensity, Mathf.Clamp01(m_DetailIntensity));
material.SetColor(s_DetailColor, m_DetailColor);
material.SetColor(s_DetailColor, ApplyColorSpace(m_DetailColor));
material.SetVector(s_DetailThreshold, new Vector2(m_DetailThreshold.min, m_DetailThreshold.max));
material.SetTexture(s_DetailTex, m_DetailFilter != 0 ? m_DetailTex : null);
material.SetVector(s_DetailTex_ST,
@@ -623,7 +623,11 @@ namespace Coffee.UIEffects
* Matrix4x4.TRS(mirrorOffset, Quaternion.identity, mirrorScale) * w2LMat);
}
if (canvas.renderMode == RenderMode.ScreenSpaceOverlay || !canvas.worldCamera)
if (canvas.renderMode == RenderMode.WorldSpace)
{
material.SetMatrix(s_CanvasToWorldMatrix, Matrix4x4.identity);
}
else if (canvas.renderMode == RenderMode.ScreenSpaceOverlay || !canvas.worldCamera)
{
material.SetMatrix(s_CanvasToWorldMatrix, canvas.transform.localToWorldMatrix);
}
@@ -830,5 +834,10 @@ namespace Coffee.UIEffects
return expandSize;
}
private static Color ApplyColorSpace(Color color)
{
return QualitySettings.activeColorSpace == ColorSpace.Linear ? color.linear : color;
}
}
}
@@ -91,7 +91,7 @@ namespace Coffee.UIEffects
[InitializeOnLoadMethod]
private static void InitializeOnLoadMethod()
{
#if UNITY_2023_2_OR_NEWER
#if !LEGACY_TMP_ENABLE
const string tmpSupport = "TextMeshPro Support (Unity 6)";
const string version = "v5.9.0 (Unity 6)";
#else
+25 -6
View File
@@ -99,7 +99,12 @@ namespace Coffee.UIEffects
public override bool canModifyShape => m_AllowToModifyMeshShape;
public override uint effectId => target ? target.effectId : 0;
public override uint effectId => target
? target.effectId
: preset
? (uint)preset.GetInstanceID()
: (uint)GetInstanceID();
public override UIEffectContext context
{
@@ -115,11 +120,25 @@ namespace Coffee.UIEffects
}
}
public override RectTransform transitionRoot => useTargetTransform && isTargetInScene
? target.transitionRoot
: m_CustomRoot
? m_CustomRoot
: transform as RectTransform;
public override RectTransform transitionRoot
{
get
{
if (preset && useTargetTransform && !m_CustomRoot && graphic && graphic.canvas)
{
return graphic.canvas.transform as RectTransform;
}
if (useTargetTransform && isTargetInScene)
{
return target.transitionRoot;
}
return m_CustomRoot
? m_CustomRoot
: transform as RectTransform;
}
}
private bool isTargetInScene => target && target.gameObject.scene.IsValid();
+1 -1
View File
@@ -152,6 +152,7 @@ Shader "Hidden/UI/Default (UIEffect)"
{
v2f IN = _fragInput;
half4 color = (tex2D(_MainTex, uv) + _TextureSampleAdd);
color.rgb *= IN.color.rgb;
color.rgb *= color.a;
return color;
}
@@ -170,7 +171,6 @@ Shader "Hidden/UI/Default (UIEffect)"
_fragInput = IN;
half4 c = uieffect(IN.texcoord, IN.uvMask, IN.worldPosition);
c.rgb *= IN.color.rgb;
c *= IN.color.a;
#ifdef UNITY_UI_CLIP_RECT
+1 -1
View File
@@ -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.9.0",
"version": "5.9.6",
"unity": "2020.3",
"license": "MIT",
"repository": {