Compare commits

...

18 Commits
3.3.8 ... 3.x

Author SHA1 Message Date
semantic-release-bot
6394eee4de chore(release): 3.3.14 [skip ci]
## [3.3.14](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.13...3.3.14) (2023-08-15)

### Bug Fixes

* error on InitializeIfNeeded ([1f1fb2a](1f1fb2a62a)), closes [#264](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/264)
2023-08-15 02:04:46 +00:00
mob-sakai
1f1fb2a62a fix: error on InitializeIfNeeded
close #264
2023-08-15 11:02:19 +09:00
semantic-release-bot
640cee9e34 chore(release): 3.3.13 [skip ci]
## [3.3.13](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.12...3.3.13) (2023-05-18)

### Bug Fixes

* memory leak when using AnimatableProperty ([3849a9f](3849a9f697))
2023-05-18 12:38:06 +00:00
mob-sakai
9dedbfb48f build: update release workflow 2023-05-18 21:37:23 +09:00
mob-sakai
3849a9f697 fix: memory leak when using AnimatableProperty 2023-05-18 21:29:36 +09:00
semantic-release-bot
69bde2cf3d chore(release): 3.3.12 [skip ci]
## [3.3.12](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.11...3.3.12) (2022-06-10)

### Bug Fixes

* always display materials in inspector ([a10042d](a10042d989))
* UNITY_UI_ALPHACLIP in UIAdditive shader is not working ([e817e8d](e817e8d3c7))
2022-06-10 11:32:11 +00:00
mob-sakai
a10042d989 fix: always display materials in inspector 2022-06-10 19:55:49 +09:00
mob-sakai
dd2d185e4a style: tab to space 2022-06-10 17:06:34 +09:00
mob-sakai
e817e8d3c7 fix: UNITY_UI_ALPHACLIP in UIAdditive shader is not working 2022-06-10 17:06:34 +09:00
semantic-release-bot
aaac2b71a3 chore(release): 3.3.11 [skip ci]
## [3.3.11](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.10...3.3.11) (2022-06-10)

### Bug Fixes

* sorting by layer does not work properly ([ccc09e6](ccc09e6aca))
* when using linear color space, the particle colors are not output correctly ([11c3a7b](11c3a7b374)), closes [#203](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/203)
2022-06-10 07:21:00 +00:00
mob-sakai
11c3a7b374 fix: when using linear color space, the particle colors are not output correctly
To fix, set 'Apply Active Color Space' in renderer module to false.

close #203
2022-06-10 16:12:15 +09:00
micromang
ccc09e6aca fix: sorting by layer does not work properly 2022-06-10 16:10:13 +09:00
semantic-release-bot
5a8f1263ef chore(release): 3.3.10 [skip ci]
## [3.3.10](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.9...3.3.10) (2022-02-17)

### Bug Fixes

* annoying warning for [ExecuteInEditMode] ([b6b2c72](b6b2c72b19)), closes [#180](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/180)
* PrefabStageUtility class is not experimental after 2021.2 ([0fd5d7a](0fd5d7affe))
2022-02-17 20:45:55 +00:00
mob-sakai
b6b2c72b19 fix: annoying warning for [ExecuteInEditMode]
Close #180
2022-02-18 04:57:27 +09:00
talessampaio-kazoo
0fd5d7affe fix: PrefabStageUtility class is not experimental after 2021.2 2022-02-18 04:46:01 +09:00
semantic-release-bot
2e4d80bc1c chore(release): 3.3.9 [skip ci]
## [3.3.9](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.8...3.3.9) (2021-08-02)

### Bug Fixes

* fix for warning CS0618 ([61760d9](61760d940c))
2021-08-02 17:49:09 +00:00
shadeAlex
6b87db7ac7 style: tab to space 2021-08-03 02:48:12 +09:00
shadeAlex
61760d940c fix: fix for warning CS0618 2021-08-03 02:48:12 +09:00
9 changed files with 209 additions and 110 deletions

View File

@@ -5,7 +5,7 @@ on:
branches:
- preview
- main
- v*.x
- "*.x"
tags-ignore:
- "**"
@@ -13,9 +13,9 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: cycjimmy/semantic-release-action@v2
- uses: cycjimmy/semantic-release-action@v3
with:
extra_plugins: |
@semantic-release/changelog

View File

@@ -1,3 +1,48 @@
## [3.3.14](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.13...3.3.14) (2023-08-15)
### Bug Fixes
* error on InitializeIfNeeded ([1f1fb2a](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/1f1fb2a62a9d2ca6562e1b1e70d528aaf52bfc82)), closes [#264](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/264)
## [3.3.13](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.12...3.3.13) (2023-05-18)
### Bug Fixes
* memory leak when using AnimatableProperty ([3849a9f](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/3849a9f6977bc6d2474001c8154a8e201f7e8b7b))
## [3.3.12](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.11...3.3.12) (2022-06-10)
### Bug Fixes
* always display materials in inspector ([a10042d](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/a10042d989dea18ff010bdbe970aa434e2bdf117))
* UNITY_UI_ALPHACLIP in UIAdditive shader is not working ([e817e8d](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/e817e8d3c75188f3243243855b135bd840699199))
## [3.3.11](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.10...3.3.11) (2022-06-10)
### Bug Fixes
* sorting by layer does not work properly ([ccc09e6](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/ccc09e6aca2fa3d7bc887e6c733e66706e40ae0f))
* when using linear color space, the particle colors are not output correctly ([11c3a7b](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/11c3a7b37415d78e1b8ba3988a6e043c9f1861e0)), closes [#203](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/203)
## [3.3.10](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.9...3.3.10) (2022-02-17)
### Bug Fixes
* annoying warning for [ExecuteInEditMode] ([b6b2c72](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/b6b2c72b198566e2880a22831c937eff7e9eff28)), closes [#180](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/180)
* PrefabStageUtility class is not experimental after 2021.2 ([0fd5d7a](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/0fd5d7affe707fa9e92abd6e192bf400dfb1a80a))
## [3.3.9](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.8...3.3.9) (2021-08-02)
### Bug Fixes
* fix for warning CS0618 ([61760d9](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/61760d940cdd4baacaa196ac1631a0a1a40b7204))
## [3.3.8](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.7...3.3.8) (2021-06-08)

View File

@@ -7,7 +7,7 @@ using UnityEngine.UI;
namespace Coffee.UIExtensions.Demos
{
#if UNITY_5_3_OR_NEWER
[ExecuteInEditMode]
[ExecuteAlways]
[RequireComponent(typeof(CanvasRenderer), typeof(ParticleSystem))]
public class UIParticleSystem_Demo : MaskableGraphic
{

View File

@@ -17,7 +17,11 @@ namespace Coffee.UIParticleExtensions
get
{
// If current scene is prefab mode, create OverlayCamera for editor.
#if UNITY_2021_2_OR_NEWER
var prefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
#else
var prefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
#endif
if (prefabStage == null || !prefabStage.scene.isLoaded) return null;
if (s_InstanceForPrefab) return s_InstanceForPrefab;

View File

@@ -30,8 +30,7 @@ namespace Coffee.UIExtensions
private SerializedProperty _spShrinkByMaterial;
private ReorderableList _ro;
private bool _xyzMode;
private bool _showMaterials;
static private bool _xyzMode;
private static readonly List<string> s_MaskablePropertyNames = new List<string>
{
@@ -58,14 +57,11 @@ namespace Coffee.UIExtensions
_spIgnoreCanvasScaler = serializedObject.FindProperty("m_IgnoreCanvasScaler");
_spAnimatableProperties = serializedObject.FindProperty("m_AnimatableProperties");
_spShrinkByMaterial = serializedObject.FindProperty("m_ShrinkByMaterial");
_showMaterials = EditorPrefs.GetBool("Coffee.UIExtensions.UIParticleEditor._showMaterials", true);
var sp = serializedObject.FindProperty("m_Particles");
_ro = new ReorderableList(sp.serializedObject, sp, true, true, true, true);
_ro.elementHeight = EditorGUIUtility.singleLineHeight * 3 + 4;
_ro.elementHeightCallback = _ => _showMaterials
? 3 * (EditorGUIUtility.singleLineHeight + 2)
: EditorGUIUtility.singleLineHeight + 2;
_ro.elementHeightCallback = _ => 3 * (EditorGUIUtility.singleLineHeight + 2);
_ro.drawElementCallback = (rect, index, active, focused) =>
{
EditorGUI.BeginDisabledGroup(sp.hasMultipleDifferentValues);
@@ -73,8 +69,6 @@ namespace Coffee.UIExtensions
rect.height = EditorGUIUtility.singleLineHeight;
var p = sp.GetArrayElementAtIndex(index);
EditorGUI.ObjectField(rect, p, GUIContent.none);
if (!_showMaterials) return;
rect.x += 15;
rect.width -= 15;
var ps = p.objectReferenceValue as ParticleSystem;
@@ -98,9 +92,6 @@ namespace Coffee.UIExtensions
#endif
EditorGUI.LabelField(new Rect(rect.x, rect.y, 150, rect.height), s_ContentRenderingOrder);
var content = EditorGUIUtility.IconContent(_showMaterials ? "VisibilityOn" : "VisibilityOff");
_showMaterials = GUI.Toggle(new Rect(rect.width - 55, rect.y, 24, 20), _showMaterials, content, EditorStyles.label);
if (GUI.Button(new Rect(rect.width - 35, rect.y, 60, rect.height), s_ContentRefresh, EditorStyles.miniButton))
{
foreach (UIParticle t in targets)
@@ -202,6 +193,24 @@ namespace Coffee.UIExtensions
DestroyUIParticle(current);
return;
}
// #203: When using linear color space, the particle colors are not output correctly.
// To fix, set 'Apply Active Color Space' in renderer module to false.
var allPsRenderers = targets.OfType<UIParticle>()
.SelectMany(x => x.particles)
.Where(x => x)
.Select(x => x.GetComponent<ParticleSystemRenderer>())
.ToArray();
if (0 < allPsRenderers.Length)
{
var so = new SerializedObject(allPsRenderers);
var sp = so.FindProperty("m_ApplyActiveColorSpace");//.boolValue = false;
if (FixButton(sp.boolValue || sp.hasMultipleDifferentValues, "When using linear color space, the particle colors are not output correctly.\nTo fix, set 'Apply Active Color Space' in renderer module to false."))
{
sp.boolValue = false;
so.ApplyModifiedProperties();
}
}
}
void DestroyUIParticle(UIParticle p, bool ignoreCurrent = false)
@@ -212,11 +221,20 @@ namespace Coffee.UIExtensions
DestroyImmediate(p);
DestroyImmediate(cr);
#if UNITY_2018_3_OR_NEWER
#if UNITY_2021_2_OR_NEWER
var stage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
#elif UNITY_2018_3_OR_NEWER
var stage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
#endif
#if UNITY_2018_3_OR_NEWER
if (stage != null && stage.scene.isLoaded)
{
PrefabUtility.SaveAsPrefabAsset(stage.prefabContentsRoot, stage.prefabAssetPath);
#if UNITY_2020_1_OR_NEWER
string prefabAssetPath = stage.assetPath;
#else
string prefabAssetPath = stage.prefabAssetPath;
#endif
PrefabUtility.SaveAsPrefabAsset(stage.prefabContentsRoot, prefabAssetPath);
}
#endif
}

View File

@@ -17,7 +17,7 @@ namespace Coffee.UIExtensions
/// <summary>
/// Render maskable and sortable particle effect ,without Camera, RenderTexture or Canvas.
/// </summary>
[ExecuteInEditMode]
[ExecuteAlways]
[RequireComponent(typeof(RectTransform))]
[RequireComponent(typeof(CanvasRenderer))]
public class UIParticle : MaskableGraphic
@@ -313,6 +313,20 @@ namespace Coffee.UIExtensions
ClearPreviousMaterials();
}
private void ClearMaterials()
{
// Clear mask materials.
s_PrevMaskMaterials.AddRange(_maskMaterials);
_maskMaterials.Clear();
// Clear modified materials.
s_PrevModifiedMaterials.AddRange(_modifiedMaterials);
_modifiedMaterials.Clear();
canvasRenderer.Clear();
ClearPreviousMaterials();
}
private void ClearPreviousMaterials()
{
foreach (var m in s_PrevMaskMaterials)
@@ -447,6 +461,7 @@ namespace Coffee.UIExtensions
_bakedMesh = null;
base.OnDisable();
ClearMaterials();
}
/// <summary>
@@ -465,6 +480,7 @@ namespace Coffee.UIExtensions
private void InitializeIfNeeded()
{
if (!this) return;
if (enabled && m_IsTrail)
{
UnityEngine.Debug.LogWarningFormat(this, "[UIParticle] The UIParticle component should be removed: {0}\nReason: UIParticle for trails is no longer needed.", name);

View File

@@ -230,7 +230,7 @@ namespace Coffee.UIParticleExtensions
// Sorting layer: ascending
if (aRenderer.sortingLayerID != bRenderer.sortingLayerID)
return aRenderer.sortingLayerID - bRenderer.sortingLayerID;
return SortingLayer.GetLayerValueFromID(aRenderer.sortingLayerID) - SortingLayer.GetLayerValueFromID(bRenderer.sortingLayerID);
// Sorting order: ascending
if (aRenderer.sortingOrder != bRenderer.sortingOrder)

View File

@@ -1,101 +1,117 @@
Shader "UI/Additive"
{
Properties
{
_MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
Properties
{
_MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_ColorMask ("Color Mask", Float) = 15
_ClipRect ("Clip Rect", Vector) = (-32767, -32767, 32767, 32767)
}
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
_ColorMask ("Color Mask", Float) = 15
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Fog { Mode Off }
Blend One One
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
}
ColorMask [_ColorMask]
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "UnityUI.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
half2 texcoord : TEXCOORD0;
float4 worldPosition : TEXCOORD1;
};
fixed4 _Color;
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _ClipRect;
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Fog { Mode Off }
Blend One One
v2f vert(appdata_t IN)
{
v2f OUT;
OUT.worldPosition = IN.vertex;
OUT.vertex = UnityObjectToClipPos(IN.vertex);
OUT.texcoord = TRANSFORM_TEX(IN.texcoord, _MainTex);
#ifdef UNITY_HALF_TEXEL_OFFSET
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
#endif
OUT.color = IN.color * _Color;
return OUT;
}
ColorMask [_ColorMask]
fixed4 frag(v2f IN) : SV_Target
{
half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
color.rgb *= color.a;
#ifdef UNITY_UI_ALPHACLIP
clip (color.a - 0.01);
#endif
return color;
}
ENDCG
}
}
Pass
{
Name "Default"
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#pragma multi_compile __ UNITY_UI_CLIP_RECT
#pragma multi_compile __ UNITY_UI_ALPHACLIP
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
float4 worldPosition : TEXCOORD1;
UNITY_VERTEX_OUTPUT_STEREO
};
fixed4 _Color;
sampler2D _MainTex;
float4 _MainTex_ST;
fixed4 _TextureSampleAdd;
float4 _ClipRect;
v2f vert(appdata_t v)
{
v2f OUT;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
OUT.worldPosition = v.vertex;
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
OUT.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
OUT.color = v.color * _Color;
return OUT;
}
fixed4 frag(v2f IN) : SV_Target
{
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
#ifdef UNITY_UI_CLIP_RECT
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
#endif
#ifdef UNITY_UI_ALPHACLIP
clip (color.a - 0.001);
#endif
color.rgb *= color.a;
return color;
}
ENDCG
}
}
}

View File

@@ -2,7 +2,7 @@
"name": "com.coffee.ui-particle",
"displayName": "UI Particle",
"description": "This plugin provide a component to render particle effect for uGUI.\nThe particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas.",
"version": "3.3.8",
"version": "3.3.14",
"unity": "2018.2",
"license": "MIT",
"repository": {