Compare commits

..

12 Commits
4.4.0 ... 4.5.2

Author SHA1 Message Date
semantic-release-bot
32b93d3eeb chore(release): 4.5.2 [skip ci]
## [4.5.2](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/4.5.1...4.5.2) (2024-01-18)

### Bug Fixes

* (editor) sometimes crashes when entering play mode ([b80c3e6](b80c3e6c9f))
2024-01-18 10:41:58 +00:00
mob-sakai
86de8b6e03 Merge pull request #289 from wmltogether/fix-deserialize-crash
Fix Editor sometimes crashes when entering Play Mode
2024-01-18 19:41:27 +09:00
wmltogether
b80c3e6c9f fix: (editor) sometimes crashes when entering play mode
If there are particle prefabs created using version 3.x in the project, there is a possibility that the editor may crash when entering Play Mode due to deserialization.
2024-01-18 19:40:12 +09:00
semantic-release-bot
6a1fef4150 chore(release): 4.5.1 [skip ci]
## [4.5.1](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/4.5.0...4.5.1) (2023-12-23)

### Bug Fixes

* fix material for mesh sharing group ([6126af9](6126af9f37))
* the changes made to the material used by the ParticleSystem are not immediately reflected ([3184ba9](3184ba94ae)), closes [#280](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/280)
2023-12-23 10:48:34 +00:00
mob-sakai
3184ba94ae fix: the changes made to the material used by the ParticleSystem are not immediately reflected
close #280
2023-12-23 19:43:50 +09:00
mob-sakai
6126af9f37 fix: fix material for mesh sharing group 2023-12-23 19:23:20 +09:00
semantic-release-bot
c6b816c312 chore(release): 4.5.0 [skip ci]
# [4.5.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/4.4.0...4.5.0) (2023-12-23)

### Bug Fixes

* incorrect rendering of world-space simulated particles while animating scale ([ac58475](ac58475539)), closes [#285](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/285)
* remove obsolete warning ([5d5eb34](5d5eb34590))

### Features

* Automatically generated objects are no longer editable (NotEditable). ([5607dc4](5607dc4eed))
* support IMeshModifier ([5c3232f](5c3232faf3)), closes [#282](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/282)
2023-12-23 07:32:51 +00:00
mob-sakai
5d5eb34590 fix: remove obsolete warning 2023-12-23 14:48:37 +09:00
mob-sakai
5c3232faf3 feat: support IMeshModifier
Custom vertex effects and CompositeCanvasRenderer are supported
close #282
2023-12-23 14:46:39 +09:00
mob-sakai
ac58475539 fix: incorrect rendering of world-space simulated particles while animating scale
close #285
2023-12-23 14:32:04 +09:00
mob-sakai
5607dc4eed feat: Automatically generated objects are no longer editable (NotEditable).
The automatically generated objects (UIParticleRenderer, UIParticleOverlayCamera) are not editable and will not be saved in scenes or prefabs.
2023-12-23 14:28:55 +09:00
mob-sakai
4e4b9eb2a7 doc: update readme 2023-11-09 14:18:16 +09:00
6 changed files with 76 additions and 11 deletions

View File

@@ -1,3 +1,32 @@
## [4.5.2](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/4.5.1...4.5.2) (2024-01-18)
### Bug Fixes
* (editor) sometimes crashes when entering play mode ([b80c3e6](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/b80c3e6c9fdd2a8fb72ff233edb85df2e3dbba3d))
## [4.5.1](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/4.5.0...4.5.1) (2023-12-23)
### Bug Fixes
* fix material for mesh sharing group ([6126af9](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/6126af9f376dd4c100a1b9d19d9499bdef7d5566))
* the changes made to the material used by the ParticleSystem are not immediately reflected ([3184ba9](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/3184ba94ae08264223c0c71443ad70acc1a1ccb2)), closes [#280](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/280)
# [4.5.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/4.4.0...4.5.0) (2023-12-23)
### Bug Fixes
* incorrect rendering of world-space simulated particles while animating scale ([ac58475](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/ac584755393d87bda2e80d9653370b7e4c68912f)), closes [#285](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/285)
* remove obsolete warning ([5d5eb34](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/5d5eb34590b7cefb0e4ac26c0441e104176ce522))
### Features
* Automatically generated objects are no longer editable (NotEditable). ([5607dc4](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/5607dc4eed0c086b4651941953df6c7d535712e0))
* support IMeshModifier ([5c3232f](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/5c3232faf3d2cfad1e3e1a9349b8346c7982a608)), closes [#282](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/282)
# [4.4.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/4.3.0...4.4.0) (2023-11-08) # [4.4.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/4.3.0...4.4.0) (2023-11-08)

View File

@@ -286,13 +286,13 @@ UIParticle does not support all built-in shaders except for `UI/Default`.
If their use is detected, an error is displayed in the inspector. If their use is detected, an error is displayed in the inspector.
Use UI shaders instead. Use UI shaders instead.
#### UV.zw components will be discarded #### (2019.4 or earlier) UV.zw components will be discarded
UIParticleRenderer renders the particles based on UIVertex. UIParticleRenderer renders the particles based on UIVertex.
Therefore, only xy components is available for each UV in the shader. (zw components will be discarded). Therefore, only xy components is available for each UV in the shader. (zw components will be discarded).
So unfortunately UIParticles will not work well with some shaders. So unfortunately UIParticles will not work well with some shaders.
#### Custom vertex streams #### (2019.4 or earlier) Custom vertex streams
When using custom vertex streams, you can fill zw components with "unnecessary" data. When using custom vertex streams, you can fill zw components with "unnecessary" data.
https://github.com/mob-sakai/ParticleEffectForUGUI/issues/191 https://github.com/mob-sakai/ParticleEffectForUGUI/issues/191

View File

@@ -7,13 +7,13 @@ namespace Coffee.UIParticleExtensions
{ {
private static readonly List<MatEntry> s_Entries = new List<MatEntry>(); private static readonly List<MatEntry> s_Entries = new List<MatEntry>();
public static Material Add(Material baseMat, Texture texture, int id) public static Material Add(Material baseMat, Texture texture, int id, int props)
{ {
MatEntry e; MatEntry e;
for (var i = 0; i < s_Entries.Count; i++) for (var i = 0; i < s_Entries.Count; i++)
{ {
e = s_Entries[i]; e = s_Entries[i];
if (e.baseMat != baseMat || e.texture != texture || e.id != id) continue; if (e.baseMat != baseMat || e.texture != texture || e.id != id || e.props != props) continue;
++e.count; ++e.count;
return e.customMat; return e.customMat;
} }
@@ -24,6 +24,7 @@ namespace Coffee.UIParticleExtensions
baseMat = baseMat, baseMat = baseMat,
texture = texture, texture = texture,
id = id, id = id,
props = props,
customMat = new Material(baseMat) customMat = new Material(baseMat)
{ {
name = $"{baseMat.name}_{id}", name = $"{baseMat.name}_{id}",
@@ -64,6 +65,7 @@ namespace Coffee.UIParticleExtensions
public int count; public int count;
public Material customMat; public Material customMat;
public int id; public int id;
public int props;
public Texture texture; public Texture texture;
} }
} }

View File

@@ -378,7 +378,7 @@ namespace Coffee.UIExtensions
#if UNITY_EDITOR #if UNITY_EDITOR
EditorApplication.delayCall += () => EditorApplication.delayCall += () =>
{ {
if (!this || !gameObject || !transform) return; if (!this || !gameObject || !transform || Application.isPlaying) return;
transform.localScale = Vector3.one; transform.localScale = Vector3.one;
m_ResetScaleOnEnable = false; m_ResetScaleOnEnable = false;
EditorUtility.SetDirty(this); EditorUtility.SetDirty(this);
@@ -647,7 +647,7 @@ namespace Coffee.UIExtensions
// Create ortho-camera. // Create ortho-camera.
if (!_orthoCamera) if (!_orthoCamera)
{ {
var go = new GameObject("[generated] UIParticleOverlayCamera") { hideFlags = HideFlags.DontSave }; var go = new GameObject("[generated] UIParticleOverlayCamera") { hideFlags = HideFlags.DontSave | HideFlags.NotEditable };
go.SetActive(false); go.SetActive(false);
go.transform.SetParent(transform, false); go.transform.SetParent(transform, false);
_orthoCamera = go.AddComponent<Camera>(); _orthoCamera = go.AddComponent<Camera>();
@@ -667,7 +667,9 @@ namespace Coffee.UIExtensions
private void UpdateTracker() private void UpdateTracker()
{ {
#pragma warning disable CS0618 // Type or member is obsolete
if (!enabled || !autoScaling || autoScalingMode != AutoScalingMode.Transform) if (!enabled || !autoScaling || autoScalingMode != AutoScalingMode.Transform)
#pragma warning restore CS0618 // Type or member is obsolete
{ {
_tracker.Clear(); _tracker.Clear();
} }

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Coffee.UIParticleExtensions; using Coffee.UIParticleExtensions;
using UnityEditor;
using UnityEngine; using UnityEngine;
using UnityEngine.Profiling; using UnityEngine.Profiling;
using UnityEngine.Rendering; using UnityEngine.Rendering;
@@ -14,6 +15,7 @@ namespace Coffee.UIExtensions
[AddComponentMenu("")] [AddComponentMenu("")]
internal class UIParticleRenderer : MaskableGraphic internal class UIParticleRenderer : MaskableGraphic
{ {
private static readonly List<Component> s_Components = new List<Component>();
private static readonly CombineInstance[] s_CombineInstances = { new CombineInstance() }; private static readonly CombineInstance[] s_CombineInstances = { new CombineInstance() };
private static readonly List<Material> s_Materials = new List<Material>(2); private static readonly List<Material> s_Materials = new List<Material>(2);
private static MaterialPropertyBlock s_Mpb; private static MaterialPropertyBlock s_Mpb;
@@ -32,6 +34,7 @@ namespace Coffee.UIExtensions
private Vector3 _prevPsPos; private Vector3 _prevPsPos;
private Vector3 _prevScale; private Vector3 _prevScale;
private Vector2Int _prevScreenSize; private Vector2Int _prevScreenSize;
private float _prevCanvasScale;
private bool _prewarm; private bool _prewarm;
private ParticleSystemRenderer _renderer; private ParticleSystemRenderer _renderer;
@@ -152,7 +155,7 @@ namespace Coffee.UIExtensions
// Create renderer object. // Create renderer object.
var go = new GameObject("[generated] UIParticleRenderer", typeof(UIParticleRenderer)) var go = new GameObject("[generated] UIParticleRenderer", typeof(UIParticleRenderer))
{ {
hideFlags = HideFlags.DontSave, hideFlags = HideFlags.DontSave | HideFlags.NotEditable,
layer = parent.gameObject.layer layer = parent.gameObject.layer
}; };
@@ -198,7 +201,12 @@ namespace Coffee.UIExtensions
// //
var id = _parent.m_AnimatableProperties.Length == 0 ? 0 : GetInstanceID(); var id = _parent.m_AnimatableProperties.Length == 0 ? 0 : GetInstanceID();
modifiedMaterial = ModifiedMaterial.Add(modifiedMaterial, texture, id); #if UNITY_EDITOR
var props = EditorJsonUtility.ToJson(modifiedMaterial).GetHashCode();
#else
var props = 0;
#endif
modifiedMaterial = ModifiedMaterial.Add(modifiedMaterial, texture, id, props);
ModifiedMaterial.Remove(_modifiedMaterial); ModifiedMaterial.Remove(_modifiedMaterial);
_modifiedMaterial = modifiedMaterial; _modifiedMaterial = modifiedMaterial;
@@ -246,6 +254,7 @@ namespace Coffee.UIExtensions
_prevScale = GetWorldScale(); _prevScale = GetWorldScale();
_prevPsPos = _particleSystem.transform.position; _prevPsPos = _particleSystem.transform.position;
_prevScreenSize = new Vector2Int(Screen.width, Screen.height); _prevScreenSize = new Vector2Int(Screen.width, Screen.height);
_prevCanvasScale = canvas ? canvas.scaleFactor : 1f;
_delay = true; _delay = true;
_prevParticleCount = 0; _prevParticleCount = 0;
@@ -399,6 +408,16 @@ namespace Coffee.UIExtensions
workerMesh.SetColors(s_Colors); workerMesh.SetColors(s_Colors);
Profiler.EndSample(); Profiler.EndSample();
} }
GetComponents(typeof(IMeshModifier), s_Components);
for (var i = 0; i < s_Components.Count; i++)
{
#pragma warning disable CS0618 // Type or member is obsolete
((IMeshModifier)s_Components[i]).ModifyMesh(workerMesh);
#pragma warning restore CS0618 // Type or member is obsolete
}
s_Components.Clear();
} }
Profiler.EndSample(); Profiler.EndSample();
@@ -430,8 +449,19 @@ namespace Coffee.UIExtensions
// Update animatable material properties. // Update animatable material properties.
Profiler.BeginSample("[UIParticleRenderer] Update Animatable Material Properties"); Profiler.BeginSample("[UIParticleRenderer] Update Animatable Material Properties");
#if UNITY_EDITOR
if (_modifiedMaterial != material)
{
_renderer.GetSharedMaterials(s_Materials);
material = s_Materials[_isTrail ? 1 : 0];
s_Materials.Clear();
SetMaterialDirty();
}
#endif
UpdateMaterialProperties(); UpdateMaterialProperties();
if (!_parent.useMeshSharing) if (_parent.useMeshSharing)
{ {
if (!_currentMaterialForRendering) if (!_currentMaterialForRendering)
{ {
@@ -534,7 +564,8 @@ namespace Coffee.UIExtensions
{ {
var screenSize = new Vector2Int(Screen.width, Screen.height); var screenSize = new Vector2Int(Screen.width, Screen.height);
var isWorldSpace = _particleSystem.IsWorldSpace(); var isWorldSpace = _particleSystem.IsWorldSpace();
var resolutionChanged = _prevScreenSize != screenSize || _prevScale != scale; var canvasScale = _parent.canvas ? _parent.canvas.scaleFactor : 1f;
var resolutionChanged = _prevScreenSize != screenSize || _prevCanvasScale != canvasScale;
if (resolutionChanged && isWorldSpace) if (resolutionChanged && isWorldSpace)
{ {
// Update particle array size and get particles. // Update particle array size and get particles.
@@ -563,6 +594,7 @@ namespace Coffee.UIExtensions
_prevPsPos = psPos; _prevPsPos = psPos;
} }
_prevCanvasScale = canvas ? canvas.scaleFactor : 1f;
_prevScreenSize = screenSize; _prevScreenSize = screenSize;
} }

View File

@@ -2,7 +2,7 @@
"name": "com.coffee.ui-particle", "name": "com.coffee.ui-particle",
"displayName": "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.", "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": "4.4.0", "version": "4.5.2",
"unity": "2018.2", "unity": "2018.2",
"license": "MIT", "license": "MIT",
"repository": { "repository": {