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
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a8f1263ef | ||
|
|
b6b2c72b19 | ||
|
|
0fd5d7affe | ||
|
|
2e4d80bc1c | ||
|
|
6b87db7ac7 | ||
|
|
61760d940c | ||
|
|
f43d4c38ea | ||
|
|
ccb8386672 | ||
|
|
e15319a46e | ||
|
|
e352d153ce | ||
|
|
4f9bbf57bc | ||
|
|
0b9d80da93 |
29
CHANGELOG.md
29
CHANGELOG.md
@@ -1,3 +1,32 @@
|
|||||||
|
## [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)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* improve performance ([e352d15](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/e352d153cef8c1efb2792e35010d7eed1e31a040))
|
||||||
|
|
||||||
|
## [3.3.7](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.6...3.3.7) (2021-06-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Refresh() will be called multiple times in the same frame, due to external assets ([0b9d80d](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/0b9d80da939580c72ca1471081d7a034edc985d4))
|
||||||
|
|
||||||
## [3.3.6](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.5...3.3.6) (2021-05-11)
|
## [3.3.6](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.5...3.3.6) (2021-05-11)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using UnityEngine.UI;
|
|||||||
namespace Coffee.UIExtensions.Demos
|
namespace Coffee.UIExtensions.Demos
|
||||||
{
|
{
|
||||||
#if UNITY_5_3_OR_NEWER
|
#if UNITY_5_3_OR_NEWER
|
||||||
[ExecuteInEditMode]
|
[ExecuteAlways]
|
||||||
[RequireComponent(typeof(CanvasRenderer), typeof(ParticleSystem))]
|
[RequireComponent(typeof(CanvasRenderer), typeof(ParticleSystem))]
|
||||||
public class UIParticleSystem_Demo : MaskableGraphic
|
public class UIParticleSystem_Demo : MaskableGraphic
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ namespace Coffee.UIParticleExtensions
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
// If current scene is prefab mode, create OverlayCamera for editor.
|
// 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();
|
var prefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
|
||||||
|
#endif
|
||||||
if (prefabStage == null || !prefabStage.scene.isLoaded) return null;
|
if (prefabStage == null || !prefabStage.scene.isLoaded) return null;
|
||||||
if (s_InstanceForPrefab) return s_InstanceForPrefab;
|
if (s_InstanceForPrefab) return s_InstanceForPrefab;
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ namespace Coffee.UIExtensions
|
|||||||
private static readonly GUIContent s_ContentTrailMaterial = new GUIContent("Trail Material");
|
private static readonly GUIContent s_ContentTrailMaterial = new GUIContent("Trail Material");
|
||||||
private static readonly GUIContent s_Content3D = new GUIContent("3D");
|
private static readonly GUIContent s_Content3D = new GUIContent("3D");
|
||||||
private static readonly GUIContent s_ContentScale = new GUIContent("Scale");
|
private static readonly GUIContent s_ContentScale = new GUIContent("Scale");
|
||||||
private static readonly List<UIParticle> s_TempParents = new List<UIParticle>();
|
|
||||||
private static readonly List<UIParticle> s_TempChildren = new List<UIParticle>();
|
|
||||||
|
|
||||||
private SerializedProperty _spMaskable;
|
private SerializedProperty _spMaskable;
|
||||||
private SerializedProperty _spScale;
|
private SerializedProperty _spScale;
|
||||||
@@ -214,11 +212,20 @@ namespace Coffee.UIExtensions
|
|||||||
DestroyImmediate(p);
|
DestroyImmediate(p);
|
||||||
DestroyImmediate(cr);
|
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();
|
var stage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
|
||||||
|
#endif
|
||||||
|
#if UNITY_2018_3_OR_NEWER
|
||||||
if (stage != null && stage.scene.isLoaded)
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Coffee.UIExtensions
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Render maskable and sortable particle effect ,without Camera, RenderTexture or Canvas.
|
/// Render maskable and sortable particle effect ,without Camera, RenderTexture or Canvas.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ExecuteInEditMode]
|
[ExecuteAlways]
|
||||||
[RequireComponent(typeof(RectTransform))]
|
[RequireComponent(typeof(RectTransform))]
|
||||||
[RequireComponent(typeof(CanvasRenderer))]
|
[RequireComponent(typeof(CanvasRenderer))]
|
||||||
public class UIParticle : MaskableGraphic
|
public class UIParticle : MaskableGraphic
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace Coffee.UIExtensions
|
|||||||
static readonly List<UIParticle> s_ActiveParticles = new List<UIParticle>();
|
static readonly List<UIParticle> s_ActiveParticles = new List<UIParticle>();
|
||||||
static MaterialPropertyBlock s_Mpb;
|
static MaterialPropertyBlock s_Mpb;
|
||||||
static ParticleSystem.Particle[] s_Particles = new ParticleSystem.Particle[2048];
|
static ParticleSystem.Particle[] s_Particles = new ParticleSystem.Particle[2048];
|
||||||
|
private static int frameCount = 0;
|
||||||
|
|
||||||
|
|
||||||
public static void Register(UIParticle particle)
|
public static void Register(UIParticle particle)
|
||||||
@@ -41,6 +42,10 @@ namespace Coffee.UIExtensions
|
|||||||
|
|
||||||
private static void Refresh()
|
private static void Refresh()
|
||||||
{
|
{
|
||||||
|
// Do not allow it to be called in the same frame.
|
||||||
|
if (frameCount == Time.frameCount) return;
|
||||||
|
frameCount = Time.frameCount;
|
||||||
|
|
||||||
Profiler.BeginSample("[UIParticle] Refresh");
|
Profiler.BeginSample("[UIParticle] Refresh");
|
||||||
for (var i = 0; i < s_ActiveParticles.Count; i++)
|
for (var i = 0; i < s_ActiveParticles.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -69,12 +74,12 @@ namespace Coffee.UIExtensions
|
|||||||
BakeMesh(particle);
|
BakeMesh(particle);
|
||||||
Profiler.EndSample();
|
Profiler.EndSample();
|
||||||
|
|
||||||
if (QualitySettings.activeColorSpace == ColorSpace.Linear)
|
// if (QualitySettings.activeColorSpace == ColorSpace.Linear)
|
||||||
{
|
// {
|
||||||
Profiler.BeginSample("[UIParticle] Modify color space to linear");
|
// Profiler.BeginSample("[UIParticle] Modify color space to linear");
|
||||||
particle.bakedMesh.ModifyColorSpaceToLinear();
|
// particle.bakedMesh.ModifyColorSpaceToLinear();
|
||||||
Profiler.EndSample();
|
// Profiler.EndSample();
|
||||||
}
|
// }
|
||||||
|
|
||||||
Profiler.BeginSample("[UIParticle] Set mesh to CanvasRenderer");
|
Profiler.BeginSample("[UIParticle] Set mesh to CanvasRenderer");
|
||||||
particle.canvasRenderer.SetMesh(particle.bakedMesh);
|
particle.canvasRenderer.SetMesh(particle.bakedMesh);
|
||||||
|
|||||||
@@ -79,18 +79,18 @@ namespace Coffee.UIParticleExtensions
|
|||||||
|
|
||||||
internal static class MeshExtensions
|
internal static class MeshExtensions
|
||||||
{
|
{
|
||||||
static readonly List<Color32> s_Colors = new List<Color32>();
|
// static readonly List<Color32> s_Colors = new List<Color32>();
|
||||||
|
|
||||||
public static void ModifyColorSpaceToLinear(this Mesh self)
|
// public static void ModifyColorSpaceToLinear(this Mesh self)
|
||||||
{
|
// {
|
||||||
self.GetColors(s_Colors);
|
// self.GetColors(s_Colors);
|
||||||
|
//
|
||||||
for (var i = 0; i < s_Colors.Count; i++)
|
// for (var i = 0; i < s_Colors.Count; i++)
|
||||||
s_Colors[i] = ((Color) s_Colors[i]).gamma;
|
// s_Colors[i] = ((Color) s_Colors[i]).gamma;
|
||||||
|
//
|
||||||
self.SetColors(s_Colors);
|
// self.SetColors(s_Colors);
|
||||||
s_Colors.Clear();
|
// s_Colors.Clear();
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static void Clear(this CombineInstance[] self)
|
public static void Clear(this CombineInstance[] self)
|
||||||
{
|
{
|
||||||
@@ -104,7 +104,8 @@ namespace Coffee.UIParticleExtensions
|
|||||||
|
|
||||||
internal static class MeshPool
|
internal static class MeshPool
|
||||||
{
|
{
|
||||||
private static readonly Stack<Mesh> s_Pool = new Stack<Mesh>();
|
private static readonly Stack<Mesh> s_Pool = new Stack<Mesh>(32);
|
||||||
|
private static readonly HashSet<int> s_HashPool = new HashSet<int>();
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
@@ -117,6 +118,7 @@ namespace Coffee.UIParticleExtensions
|
|||||||
var m = new Mesh();
|
var m = new Mesh();
|
||||||
m.MarkDynamic();
|
m.MarkDynamic();
|
||||||
s_Pool.Push(m);
|
s_Pool.Push(m);
|
||||||
|
s_HashPool.Add(m.GetInstanceID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +128,11 @@ namespace Coffee.UIParticleExtensions
|
|||||||
while (0 < s_Pool.Count)
|
while (0 < s_Pool.Count)
|
||||||
{
|
{
|
||||||
m = s_Pool.Pop();
|
m = s_Pool.Pop();
|
||||||
if (m) return m;
|
if (m)
|
||||||
|
{
|
||||||
|
s_HashPool.Remove(m.GetInstanceID());
|
||||||
|
return m;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m = new Mesh();
|
m = new Mesh();
|
||||||
@@ -136,9 +142,14 @@ namespace Coffee.UIParticleExtensions
|
|||||||
|
|
||||||
public static void Return(Mesh mesh)
|
public static void Return(Mesh mesh)
|
||||||
{
|
{
|
||||||
if (!mesh || s_Pool.Contains(mesh)) return;
|
if (!mesh) return;
|
||||||
|
|
||||||
|
var id = mesh.GetInstanceID();
|
||||||
|
if (s_HashPool.Contains(id)) return;
|
||||||
|
|
||||||
mesh.Clear(false);
|
mesh.Clear(false);
|
||||||
s_Pool.Push(mesh);
|
s_Pool.Push(mesh);
|
||||||
|
s_HashPool.Add(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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": "3.3.6",
|
"version": "3.3.10",
|
||||||
"unity": "2018.2",
|
"unity": "2018.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
Reference in New Issue
Block a user