You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-05-15 12:40:08 +00:00
Compare commits
2 Commits
release-pr
...
v4.10.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4faf151c87 | ||
|
|
afe00a1dde |
@@ -1,15 +1,9 @@
|
|||||||
# [5.0.0-preview.11](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v5.0.0-preview.10...v5.0.0-preview.11) (2024-09-29)
|
## [4.10.2](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.10.1...v4.10.2) (2024-11-01)
|
||||||
|
|
||||||
|
|
||||||
### Features
|
### Bug Fixes
|
||||||
|
|
||||||
* change the default value of `UIParticle.scale` from `10` to `1` ([4e188dd](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/4e188dd39ee32dd1339066a6946e43ba3580c324))
|
* trail incorrect offset ([afe00a1](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/afe00a1dde80eb1c0a7bb668b75f4c3733d3fa43)), closes [#335](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/335)
|
||||||
* UIParticle no longer inherits from MaskableGraphic ([52eb28c](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/52eb28cdafe7c9009d5a4b76978e002798440e8d))
|
|
||||||
|
|
||||||
|
|
||||||
### BREAKING CHANGES
|
|
||||||
|
|
||||||
* Some members inherited from MaskableGraphic will no longer be available.
|
|
||||||
|
|
||||||
## [4.10.1](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.10.0...v4.10.1) (2024-09-29)
|
## [4.10.1](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.10.0...v4.10.1) (2024-09-29)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
using UnityEditor.UI;
|
||||||
using UnityEditorInternal;
|
using UnityEditorInternal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Profiling;
|
using UnityEngine.Profiling;
|
||||||
@@ -25,7 +26,7 @@ namespace Coffee.UIExtensions
|
|||||||
{
|
{
|
||||||
[CustomEditor(typeof(UIParticle))]
|
[CustomEditor(typeof(UIParticle))]
|
||||||
[CanEditMultipleObjects]
|
[CanEditMultipleObjects]
|
||||||
internal class UIParticleEditor : Editor
|
internal class UIParticleEditor : GraphicEditor
|
||||||
{
|
{
|
||||||
//################################
|
//################################
|
||||||
// Constant or Static Members.
|
// Constant or Static Members.
|
||||||
@@ -80,8 +81,10 @@ namespace Coffee.UIExtensions
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function is called when the object becomes enabled and active.
|
/// This function is called when the object becomes enabled and active.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnEnable()
|
protected override void OnEnable()
|
||||||
{
|
{
|
||||||
|
base.OnEnable();
|
||||||
|
|
||||||
_maskable = serializedObject.FindProperty("m_Maskable");
|
_maskable = serializedObject.FindProperty("m_Maskable");
|
||||||
_scale3D = serializedObject.FindProperty("m_Scale3D");
|
_scale3D = serializedObject.FindProperty("m_Scale3D");
|
||||||
_animatableProperties = serializedObject.FindProperty("m_AnimatableProperties");
|
_animatableProperties = serializedObject.FindProperty("m_AnimatableProperties");
|
||||||
@@ -434,11 +437,9 @@ namespace Coffee.UIExtensions
|
|||||||
{
|
{
|
||||||
if (!p || (ignoreCurrent && target == p)) return;
|
if (!p || (ignoreCurrent && target == p)) return;
|
||||||
|
|
||||||
Misc.DestroyImmediate(p);
|
var cr = p.canvasRenderer;
|
||||||
if (p.TryGetComponent<CanvasRenderer>(out var cr))
|
DestroyImmediate(p);
|
||||||
{
|
DestroyImmediate(cr);
|
||||||
Misc.DestroyImmediate(cr);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if UNITY_2018_3_OR_NEWER
|
#if UNITY_2018_3_OR_NEWER
|
||||||
var stage = PrefabStageUtility.GetCurrentPrefabStage();
|
var stage = PrefabStageUtility.GetCurrentPrefabStage();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
[](https://github.com/mob-sakai/ParticleEffectForUGUI/subscription)
|
[](https://github.com/mob-sakai/ParticleEffectForUGUI/subscription)
|
||||||
[](https://twitter.com/intent/follow?screen_name=mob_sakai)
|
[](https://twitter.com/intent/follow?screen_name=mob_sakai)
|
||||||
|
|
||||||
<< [📝 Description](#-description-) | [📌 Key Features](#-key-features) | [🎮 Demo](#-demo) | [⚙ Installation](#-installation) | [🔄 Upgrading to 5.x](#-upgrading-from-3x4x-to-5x) | [🚀 Usage](#-usage) | [🛠 Development Note](#-development-note) | [🤝 Contributing](#-contributing) >>
|
<< [📝 Description](#-description-) | [📌 Key Features](#-key-features) | [🎮 Demo](#-demo) | [⚙ Installation](#-installation) | [🚀 Usage](#-usage) | [🛠 Development Note](#-development-note) | [🤝 Contributing](#-contributing) >>
|
||||||
|
|
||||||
## 📝 Description <!-- omit in toc -->
|
## 📝 Description <!-- omit in toc -->
|
||||||
|
|
||||||
@@ -27,8 +27,6 @@ You can render, mask, and sort your `ParticleSystems` for UI without the need fo
|
|||||||
- [Install via UPM (with Package Manager UI)](#install-via-upm-with-package-manager-ui)
|
- [Install via UPM (with Package Manager UI)](#install-via-upm-with-package-manager-ui)
|
||||||
- [Install via UPM (Manually)](#install-via-upm-manually)
|
- [Install via UPM (Manually)](#install-via-upm-manually)
|
||||||
- [Install as Embedded Package](#install-as-embedded-package)
|
- [Install as Embedded Package](#install-as-embedded-package)
|
||||||
- [🔄 Upgrading from 3.x/4.x to 5.x](#-upgrading-from-3x4x-to-5x)
|
|
||||||
- [Breaking Changes](#breaking-changes)
|
|
||||||
- [🚀 Usage](#-usage)
|
- [🚀 Usage](#-usage)
|
||||||
- [Component: UIParticle](#component-uiparticle)
|
- [Component: UIParticle](#component-uiparticle)
|
||||||
- [Basic Usage](#basic-usage)
|
- [Basic Usage](#basic-usage)
|
||||||
@@ -154,17 +152,6 @@ _This package requires **Unity 2018.3 or later**._
|
|||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
## 🔄 Upgrading from 3.x/4.x to 5.x
|
|
||||||
|
|
||||||
### Breaking Changes
|
|
||||||
|
|
||||||
- The default value of `UIParticle.scale` has been changed from `10` to `1`.
|
|
||||||
- `UIParticle` no longer inherits from `MaskableGraphic`.
|
|
||||||
- Add project settings for UIParticle
|
|
||||||
- enableLinearToGamma: Enables LinearToGamma during mesh baking
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
|
|
||||||
## 🚀 Usage
|
## 🚀 Usage
|
||||||
|
|
||||||
### Component: UIParticle
|
### Component: UIParticle
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Coffee.UIParticleInternal;
|
using Coffee.UIParticleInternal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
|
||||||
using UnityEngine.Rendering;
|
using UnityEngine.Rendering;
|
||||||
using UnityEngine.Serialization;
|
using UnityEngine.Serialization;
|
||||||
|
using UnityEngine.UI;
|
||||||
using Random = UnityEngine.Random;
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("Coffee.UIParticle.Editor")]
|
[assembly: InternalsVisibleTo("Coffee.UIParticle.Editor")]
|
||||||
@@ -18,7 +18,7 @@ namespace Coffee.UIExtensions
|
|||||||
[ExecuteAlways]
|
[ExecuteAlways]
|
||||||
[RequireComponent(typeof(RectTransform))]
|
[RequireComponent(typeof(RectTransform))]
|
||||||
[RequireComponent(typeof(CanvasRenderer))]
|
[RequireComponent(typeof(CanvasRenderer))]
|
||||||
public class UIParticle : UIBehaviour, ISerializationCallbackReceiver
|
public class UIParticle : MaskableGraphic, ISerializationCallbackReceiver
|
||||||
{
|
{
|
||||||
public enum AutoScalingMode
|
public enum AutoScalingMode
|
||||||
{
|
{
|
||||||
@@ -60,7 +60,7 @@ namespace Coffee.UIExtensions
|
|||||||
|
|
||||||
[Tooltip("Scale the rendering particles. When the `3D` toggle is enabled, 3D scale (x, y, z) is supported.")]
|
[Tooltip("Scale the rendering particles. When the `3D` toggle is enabled, 3D scale (x, y, z) is supported.")]
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Vector3 m_Scale3D = new Vector3(1, 1, 1);
|
private Vector3 m_Scale3D = new Vector3(10, 10, 10);
|
||||||
|
|
||||||
[Tooltip("If you want to update material properties (e.g. _MainTex_ST, _Color) in AnimationClip, " +
|
[Tooltip("If you want to update material properties (e.g. _MainTex_ST, _Color) in AnimationClip, " +
|
||||||
"use this to mark as animatable.")]
|
"use this to mark as animatable.")]
|
||||||
@@ -117,48 +117,20 @@ namespace Coffee.UIExtensions
|
|||||||
"Change the bake view size.")]
|
"Change the bake view size.")]
|
||||||
private float m_CustomViewSize = 10;
|
private float m_CustomViewSize = 10;
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private bool m_Maskable = true;
|
|
||||||
|
|
||||||
private readonly List<UIParticleRenderer> _renderers = new List<UIParticleRenderer>();
|
private readonly List<UIParticleRenderer> _renderers = new List<UIParticleRenderer>();
|
||||||
private Camera _bakeCamera;
|
private Camera _bakeCamera;
|
||||||
private Canvas _canvas;
|
|
||||||
private int _groupId;
|
private int _groupId;
|
||||||
private bool _isScaleStored;
|
private bool _isScaleStored;
|
||||||
private Vector3 _storedScale;
|
private Vector3 _storedScale;
|
||||||
private DrivenRectTransformTracker _tracker;
|
private DrivenRectTransformTracker _tracker;
|
||||||
|
|
||||||
public RectTransform rectTransform => transform as RectTransform;
|
|
||||||
|
|
||||||
public Canvas canvas
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_canvas) return _canvas;
|
|
||||||
|
|
||||||
var tr = transform;
|
|
||||||
while (tr && !_canvas)
|
|
||||||
{
|
|
||||||
if (tr.TryGetComponent(out _canvas)) return _canvas;
|
|
||||||
tr = tr.parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does this graphic allow masking.
|
/// Should this graphic be considered a target for ray-casting?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool maskable
|
public override bool raycastTarget
|
||||||
{
|
{
|
||||||
get => m_Maskable;
|
get => false;
|
||||||
set
|
set { }
|
||||||
{
|
|
||||||
if (value == m_Maskable) return;
|
|
||||||
m_Maskable = value;
|
|
||||||
UpdateRendererMaterial();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -335,15 +307,15 @@ namespace Coffee.UIExtensions
|
|||||||
|
|
||||||
public Vector3 parentScale { get; private set; }
|
public Vector3 parentScale { get; private set; }
|
||||||
|
|
||||||
private Vector3 canvasScale { get; set; }
|
public Vector3 canvasScale { get; private set; }
|
||||||
|
|
||||||
protected override void OnEnable()
|
protected override void OnEnable()
|
||||||
{
|
{
|
||||||
_isScaleStored = false;
|
_isScaleStored = false;
|
||||||
ResetGroupId();
|
ResetGroupId();
|
||||||
UIParticleUpdater.Register(this);
|
UIParticleUpdater.Register(this);
|
||||||
|
RegisterDirtyMaterialCallback(UpdateRendererMaterial);
|
||||||
|
|
||||||
//
|
|
||||||
if (0 < particles.Count)
|
if (0 < particles.Count)
|
||||||
{
|
{
|
||||||
RefreshParticles(particles);
|
RefreshParticles(particles);
|
||||||
@@ -353,7 +325,7 @@ namespace Coffee.UIExtensions
|
|||||||
RefreshParticles();
|
RefreshParticles();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateRendererMaterial();
|
base.OnEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -370,15 +342,9 @@ namespace Coffee.UIExtensions
|
|||||||
_isScaleStored = false;
|
_isScaleStored = false;
|
||||||
UIParticleUpdater.Unregister(this);
|
UIParticleUpdater.Unregister(this);
|
||||||
_renderers.ForEach(r => r.Reset());
|
_renderers.ForEach(r => r.Reset());
|
||||||
_canvas = null;
|
UnregisterDirtyMaterialCallback(UpdateRendererMaterial);
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
base.OnDisable();
|
||||||
/// Called when the state of the parent Canvas is changed.
|
|
||||||
/// </summary>
|
|
||||||
protected override void OnCanvasHierarchyChanged()
|
|
||||||
{
|
|
||||||
_canvas = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -388,14 +354,6 @@ namespace Coffee.UIExtensions
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function is called when a direct or indirect parent of the transform of the GameObject has changed.
|
|
||||||
/// </summary>
|
|
||||||
protected override void OnTransformParentChanged()
|
|
||||||
{
|
|
||||||
_canvas = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ISerializationCallbackReceiver.OnBeforeSerialize()
|
void ISerializationCallbackReceiver.OnBeforeSerialize()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -688,6 +646,17 @@ namespace Coffee.UIExtensions
|
|||||||
: Random.Range(m_GroupId, m_GroupMaxId + 1);
|
: Random.Range(m_GroupId, m_GroupMaxId + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void UpdateMaterial()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Call to update the geometry of the Graphic onto the CanvasRenderer.
|
||||||
|
/// </summary>
|
||||||
|
protected override void UpdateGeometry()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateRendererMaterial()
|
private void UpdateRendererMaterial()
|
||||||
{
|
{
|
||||||
for (var i = 0; i < _renderers.Count; i++)
|
for (var i = 0; i < _renderers.Count; i++)
|
||||||
|
|||||||
@@ -542,6 +542,12 @@ namespace Coffee.UIExtensions
|
|||||||
return Matrix4x4.Translate(psPos)
|
return Matrix4x4.Translate(psPos)
|
||||||
* Matrix4x4.Scale(scale);
|
* Matrix4x4.Scale(scale);
|
||||||
case ParticleSystemSimulationSpace.World:
|
case ParticleSystemSimulationSpace.World:
|
||||||
|
if (_isTrail)
|
||||||
|
{
|
||||||
|
return Matrix4x4.Translate(psPos)
|
||||||
|
* Matrix4x4.Scale(scale)
|
||||||
|
* Matrix4x4.Translate(-psPos);
|
||||||
|
}
|
||||||
return Matrix4x4.Scale(scale);
|
return Matrix4x4.Scale(scale);
|
||||||
case ParticleSystemSimulationSpace.Custom:
|
case ParticleSystemSimulationSpace.Custom:
|
||||||
return Matrix4x4.Translate(_particleSystem.main.customSimulationSpace.position.GetScaled(scale))
|
return Matrix4x4.Translate(_particleSystem.main.customSimulationSpace.position.GetScaled(scale))
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "com.coffee.ui-particle",
|
"name": "com.coffee.ui-particle",
|
||||||
"displayName": "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.",
|
"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": "5.0.0-preview.11",
|
"version": "4.10.2",
|
||||||
"unity": "2018.2",
|
"unity": "2018.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
Reference in New Issue
Block a user