You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-05-14 20:20:06 +00:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22795fca9a | ||
|
|
1aca69bbb7 | ||
|
|
3619b4ff94 | ||
|
|
cc3e95d8c7 | ||
|
|
5c28e9a2f3 | ||
|
|
b82f79c2de | ||
|
|
f029b7508e | ||
|
|
5c41c39847 | ||
|
|
49f46d5c9e | ||
|
|
628b9582b2 | ||
|
|
e8c9873201 | ||
|
|
fa6881a028 | ||
|
|
e0c8f6ade8 | ||
|
|
612015f7cf | ||
|
|
09c2c95f3b | ||
|
|
3454273095 | ||
|
|
e82b35466b | ||
|
|
50ba446cff | ||
|
|
d4ffadf599 | ||
|
|
4a940d8e31 |
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"branches": [
|
||||
"release",
|
||||
"release-4.x",
|
||||
{
|
||||
"name": "preview",
|
||||
"name": "release-preview",
|
||||
"prerelease": true
|
||||
}
|
||||
],
|
||||
|
||||
52
CHANGELOG.md
52
CHANGELOG.md
@@ -1,3 +1,55 @@
|
||||
# [4.7.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.8...v4.7.0) (2024-06-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* `UIParticle.transform.localScale` does not scale particles ([1d40e24](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/1d40e24c742741e97f03c55468ccb1e505341133)), closes [#313](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/313)
|
||||
* UIParticle is scaled by canvas size even when `AutoScalingMode.None` and `ScalingMode.Local` ([54a4b1c](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/54a4b1cdfd06400c7be89c1ee704bb42a659c7c2)), closes [#313](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/313)
|
||||
* UIParticle is scaled incorrectly with nested canvases ([f26920f](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/f26920f9825547222a4afbb31cc5dc5a002c3e9b)), closes [#313](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/313)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* reset previous position on start play for world space simulation ([3880484](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/3880484ce5190c42fc79c81d0b69e3fbeda09dd0)), closes [#303](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/303)
|
||||
* restore `Transform.localScale` when setting `autoScalingMode` to something other than `Transform` ([5505247](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/5505247a94a929ff89635fde512a9b95691e0043))
|
||||
|
||||
## [4.6.8](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.7...v4.6.8) (2024-06-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 'Resource ID out of range in GetResource' error in overlay rendering mode ([05286ce](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/05286cedfd17b1a0cb90a5e918513644f47cd831)), closes [#308](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/308)
|
||||
|
||||
## [4.6.7](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.6...v4.6.7) (2024-05-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* the ParticleSystem's localPosition drifts at certain scales due to floating-point precision issues ([e924eb4](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/e924eb45968a112347471cabaeabc274e4c37ce4)), closes [#299](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/299) [#312](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/312)
|
||||
|
||||
## [4.6.6](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.5...v4.6.6) (2024-05-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix release workflow ([30b0076](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/30b00762f6da166c043587798b1552f27b4cc604))
|
||||
|
||||
## [4.6.5](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.4...v4.6.5) (2024-05-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update workflows (for preview and v4) ([3eab097](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/3eab0979b9b85919b804442ab05735b7120eade5))
|
||||
|
||||
## [4.6.4](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.3...v4.6.4) (2024-05-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* assertion failed on expression: 'ps->array_size()' ([1b5c359](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/1b5c359058289895caf5f245fe09abb643bc38eb)), closes [#278](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/278)
|
||||
* lost Material.mainTexture when using AnimatableProperties ([ea04352](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/ea043524c0b00f67cba26a1f9ea537ee4a56d6ff)), closes [#311](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/311)
|
||||
* remove unnecessary code ([c37c014](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/c37c01486499773e3d7e8296c95bb4c3fae94abb))
|
||||
|
||||
## [4.6.3](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.6.2...v4.6.3) (2024-04-04)
|
||||
|
||||
|
||||
|
||||
@@ -475,20 +475,7 @@ namespace Coffee.UIExtensions
|
||||
|
||||
private static void DrawAutoScaling(SerializedProperty prop, IEnumerable<UIParticle> uiParticles)
|
||||
{
|
||||
var isTransformMode = prop.intValue == (int)UIParticle.AutoScalingMode.Transform;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(prop);
|
||||
if (!EditorGUI.EndChangeCheck() || !isTransformMode) return;
|
||||
|
||||
// on changed true->false, reset scale.
|
||||
EditorApplication.delayCall += () =>
|
||||
{
|
||||
foreach (var uip in uiParticles)
|
||||
{
|
||||
if (!uip) continue;
|
||||
uip.transform.localScale = Vector3.one;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#if UNITY_2021_2_OR_NEWER
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Coffee.UIParticleExtensions
|
||||
{
|
||||
name = $"{baseMat.name}_{id}",
|
||||
hideFlags = HideFlags.DontSave | HideFlags.NotEditable,
|
||||
mainTexture = texture ? texture : null
|
||||
mainTexture = texture ? texture : baseMat.mainTexture
|
||||
}
|
||||
};
|
||||
s_Entries.Add(e);
|
||||
|
||||
@@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Coffee.UIParticleExtensions;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Serialization;
|
||||
@@ -104,6 +103,8 @@ namespace Coffee.UIExtensions
|
||||
private int _groupId;
|
||||
private Camera _orthoCamera;
|
||||
private DrivenRectTransformTracker _tracker;
|
||||
private Vector3 _storedScale;
|
||||
private bool _isScaleStored;
|
||||
|
||||
/// <summary>
|
||||
/// Should this graphic be considered a target for ray-casting?
|
||||
@@ -201,7 +202,12 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
if (m_AutoScalingMode == value) return;
|
||||
m_AutoScalingMode = value;
|
||||
UpdateTracker();
|
||||
|
||||
if (autoScalingMode != AutoScalingMode.Transform && _isScaleStored)
|
||||
{
|
||||
transform.localScale = _storedScale;
|
||||
_isScaleStored = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,9 +250,9 @@ namespace Coffee.UIExtensions
|
||||
/// <summary>
|
||||
/// Particle effect scale.
|
||||
/// </summary>
|
||||
public Vector3 scale3DForCalc => autoScalingMode == AutoScalingMode.UIParticle
|
||||
? m_Scale3D.GetScaled(canvasScale)
|
||||
: m_Scale3D;
|
||||
public Vector3 scale3DForCalc => autoScalingMode == AutoScalingMode.Transform
|
||||
? m_Scale3D
|
||||
: m_Scale3D.GetScaled(canvasScale, transform.localScale);
|
||||
|
||||
public List<ParticleSystem> particles => m_Particles;
|
||||
|
||||
@@ -279,8 +285,8 @@ namespace Coffee.UIExtensions
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
_isScaleStored = false;
|
||||
ResetGroupId();
|
||||
UpdateTracker();
|
||||
UIParticleUpdater.Register(this);
|
||||
RegisterDirtyMaterialCallback(UpdateRendererMaterial);
|
||||
|
||||
@@ -301,7 +307,13 @@ namespace Coffee.UIExtensions
|
||||
/// </summary>
|
||||
protected override void OnDisable()
|
||||
{
|
||||
UpdateTracker();
|
||||
_tracker.Clear();
|
||||
if (autoScalingMode == AutoScalingMode.Transform && _isScaleStored)
|
||||
{
|
||||
transform.localScale = _storedScale;
|
||||
}
|
||||
|
||||
_isScaleStored = false;
|
||||
UIParticleUpdater.Unregister(this);
|
||||
_renderers.ForEach(r => r.Reset());
|
||||
UnregisterDirtyMaterialCallback(UpdateRendererMaterial);
|
||||
@@ -316,14 +328,6 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void OnValidate()
|
||||
{
|
||||
base.OnValidate();
|
||||
UpdateTracker();
|
||||
}
|
||||
#endif
|
||||
|
||||
void ISerializationCallbackReceiver.OnBeforeSerialize()
|
||||
{
|
||||
}
|
||||
@@ -482,12 +486,26 @@ namespace Coffee.UIExtensions
|
||||
|
||||
internal void UpdateTransformScale()
|
||||
{
|
||||
_tracker.Clear();
|
||||
canvasScale = canvas.rootCanvas.transform.localScale.Inverse();
|
||||
parentScale = transform.parent.lossyScale;
|
||||
if (autoScalingMode != AutoScalingMode.Transform) return;
|
||||
if (autoScalingMode != AutoScalingMode.Transform)
|
||||
{
|
||||
if (_isScaleStored)
|
||||
{
|
||||
transform.localScale = _storedScale;
|
||||
}
|
||||
|
||||
_isScaleStored = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var currentScale = transform.localScale;
|
||||
_storedScale = currentScale;
|
||||
_isScaleStored = true;
|
||||
_tracker.Add(this, rectTransform, DrivenTransformProperties.Scale);
|
||||
var newScale = parentScale.Inverse();
|
||||
if (transform.localScale != newScale)
|
||||
if (currentScale != newScale)
|
||||
{
|
||||
transform.localScale = newScale;
|
||||
}
|
||||
@@ -605,22 +623,14 @@ namespace Coffee.UIExtensions
|
||||
_orthoCamera.transform.SetPositionAndRotation(new Vector3(0, 0, -1000), Quaternion.identity);
|
||||
_orthoCamera.orthographic = true;
|
||||
_orthoCamera.farClipPlane = 2000f;
|
||||
_orthoCamera.clearFlags = CameraClearFlags.Nothing;
|
||||
_orthoCamera.cullingMask = 0; // Nothing
|
||||
_orthoCamera.allowHDR = false;
|
||||
_orthoCamera.allowMSAA = false;
|
||||
_orthoCamera.renderingPath = RenderingPath.Forward;
|
||||
_orthoCamera.useOcclusionCulling = false;
|
||||
|
||||
return _orthoCamera;
|
||||
}
|
||||
|
||||
private void UpdateTracker()
|
||||
{
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
if (!enabled || !autoScaling || autoScalingMode != AutoScalingMode.Transform)
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
{
|
||||
_tracker.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
_tracker.Add(this, rectTransform, DrivenTransformProperties.Scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace Coffee.UIExtensions
|
||||
private float _prevCanvasScale;
|
||||
private Vector3 _prevPsPos;
|
||||
private Vector3 _prevScale;
|
||||
private bool _isPrevStored;
|
||||
private Vector2Int _prevScreenSize;
|
||||
private bool _prewarm;
|
||||
private ParticleSystemRenderer _renderer;
|
||||
@@ -146,6 +147,7 @@ namespace Coffee.UIExtensions
|
||||
ModifiedMaterial.Remove(_modifiedMaterial);
|
||||
_modifiedMaterial = null;
|
||||
_currentMaterialForRendering = null;
|
||||
_isPrevStored = false;
|
||||
}
|
||||
|
||||
public static UIParticleRenderer AddRenderer(UIParticle parent, int index)
|
||||
@@ -329,6 +331,14 @@ namespace Coffee.UIExtensions
|
||||
// Bake mesh.
|
||||
Profiler.BeginSample("[UIParticleRenderer] Bake Mesh");
|
||||
s_CombineInstances[0].mesh.Clear(false);
|
||||
|
||||
// Assertion failed on expression: 'ps->array_size()' #278
|
||||
var extends = s_CombineInstances[0].mesh.bounds.extents.x;
|
||||
if (!float.IsNaN(extends) && !float.IsInfinity(extends) && 0 < extends)
|
||||
{
|
||||
s_CombineInstances[0].mesh.RecalculateBounds();
|
||||
}
|
||||
|
||||
if (_isTrail && _parent.canSimulate && 0 < _particleSystem.particleCount)
|
||||
{
|
||||
#if PS_BAKE_API_V2
|
||||
@@ -352,7 +362,6 @@ namespace Coffee.UIExtensions
|
||||
// Too many vertices to render.
|
||||
if (65535 <= s_CombineInstances[0].mesh.vertexCount)
|
||||
{
|
||||
s_CombineInstances[0].mesh.Clear(false);
|
||||
Debug.LogErrorFormat(this,
|
||||
"Too many vertices to render. index={0}, isTrail={1}, vertexCount={2}(>=65535)",
|
||||
_index,
|
||||
@@ -517,7 +526,7 @@ namespace Coffee.UIExtensions
|
||||
&& _particleSystem.main.scalingMode == ParticleSystemScalingMode.Local
|
||||
&& _parent.canvas)
|
||||
{
|
||||
scale = scale.GetScaled(_parent.canvas.transform.localScale);
|
||||
scale = scale.GetScaled(_parent.canvas.rootCanvas.transform.localScale);
|
||||
}
|
||||
|
||||
Profiler.EndSample();
|
||||
@@ -574,7 +583,7 @@ namespace Coffee.UIExtensions
|
||||
var isWorldSpace = _particleSystem.IsWorldSpace();
|
||||
var canvasScale = _parent.canvas ? _parent.canvas.scaleFactor : 1f;
|
||||
var resolutionChanged = _prevScreenSize != screenSize || _prevCanvasScale != canvasScale;
|
||||
if (resolutionChanged && isWorldSpace)
|
||||
if (resolutionChanged && isWorldSpace && _isPrevStored)
|
||||
{
|
||||
// Update particle array size and get particles.
|
||||
var size = _particleSystem.particleCount;
|
||||
@@ -600,6 +609,7 @@ namespace Coffee.UIExtensions
|
||||
_delay = true;
|
||||
_prevScale = scale;
|
||||
_prevPsPos = psPos;
|
||||
_isPrevStored = true;
|
||||
}
|
||||
|
||||
_prevCanvasScale = canvas ? canvas.scaleFactor : 1f;
|
||||
@@ -625,13 +635,15 @@ namespace Coffee.UIExtensions
|
||||
// get world position.
|
||||
var isLocalSpace = _particleSystem.IsLocalSpace();
|
||||
var psTransform = _particleSystem.transform;
|
||||
var originLocalPosition = psTransform.localPosition;
|
||||
var originLocalRotation = psTransform.localRotation;
|
||||
var originWorldPosition = psTransform.position;
|
||||
var originWorldRotation = psTransform.rotation;
|
||||
var emission = _particleSystem.emission;
|
||||
var rateOverDistance = emission.enabled
|
||||
&& 0 < emission.rateOverDistance.constant
|
||||
&& 0 < emission.rateOverDistanceMultiplier;
|
||||
if (rateOverDistance && !paused)
|
||||
if (rateOverDistance && !paused && _isPrevStored)
|
||||
{
|
||||
// (For rate-over-distance emission,) Move to previous scaled position, simulate (delta = 0).
|
||||
var prevScaledPos = isLocalSpace
|
||||
@@ -647,7 +659,8 @@ namespace Coffee.UIExtensions
|
||||
: originWorldPosition.GetScaled(scale.Inverse());
|
||||
psTransform.SetPositionAndRotation(scaledPos, originWorldRotation);
|
||||
_particleSystem.Simulate(deltaTime, false, false, false);
|
||||
psTransform.SetPositionAndRotation(originWorldPosition, originWorldRotation);
|
||||
psTransform.localPosition = originLocalPosition;
|
||||
psTransform.localRotation = originLocalRotation;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
||||
@@ -57,9 +57,8 @@ namespace Coffee.UIExtensions
|
||||
for (var i = 0; i < s_ActiveParticles.Count; i++)
|
||||
{
|
||||
var uip = s_ActiveParticles[i];
|
||||
if (!uip || !uip.canvas || !uip.isPrimary || s_UpdatedGroupIds.Contains(uip.groupId)) continue;
|
||||
if (!uip || !uip.canvas || !uip.isPrimary || !s_UpdatedGroupIds.Add(uip.groupId)) continue;
|
||||
|
||||
s_UpdatedGroupIds.Add(uip.groupId);
|
||||
uip.UpdateTransformScale();
|
||||
uip.UpdateRenderers();
|
||||
}
|
||||
@@ -76,9 +75,8 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
uip.UpdateRenderers();
|
||||
}
|
||||
else if (!s_UpdatedGroupIds.Contains(uip.groupId))
|
||||
else if (s_UpdatedGroupIds.Add(uip.groupId))
|
||||
{
|
||||
s_UpdatedGroupIds.Add(uip.groupId);
|
||||
uip.UpdateRenderers();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14461,7 +14461,7 @@ Canvas:
|
||||
m_GameObject: {fileID: 1074082869}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 0
|
||||
m_RenderMode: 1
|
||||
m_Camera: {fileID: 1023393581}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "com.coffee.ui-particle",
|
||||
"displayName": "UI Particle",
|
||||
"description": "This package provides a component to render particle effects for uGUI.\nThe particle rendering is maskable and sortable, without the need for an extra Camera, RenderTexture, or Canvas.",
|
||||
"version": "4.6.3",
|
||||
"version": "4.7.0",
|
||||
"unity": "2018.2",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user