You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-06-29 11:03:44 +00:00
Compare commits
6 Commits
9eb094bb43
...
release
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93e38622ee | ||
|
|
c9a97e41d5 | ||
|
|
dc120884f6 | ||
|
|
5393947b3b | ||
|
|
bad976cf01 | ||
|
|
26fd3da20b |
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
||||
split_to: ${{ steps.summary.outputs.split_to }}
|
||||
steps:
|
||||
- name: 🚚 Checkout (${{ github.ref_name }})
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: 🔖 Run semantic release
|
||||
uses: cycjimmy/semantic-release-action@v6
|
||||
@@ -67,7 +67,7 @@ jobs:
|
||||
contents: write
|
||||
steps:
|
||||
- name: 🚚 Checkout (${{ needs.release.outputs.merge_to }})
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ needs.release.outputs.merge_to }}
|
||||
fetch-depth: 0
|
||||
@@ -88,7 +88,7 @@ jobs:
|
||||
contents: write
|
||||
steps:
|
||||
- name: 🚚 Checkout (${{ needs.release.outputs.tag }})
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ needs.release.outputs.tag }}
|
||||
fetch-depth: 0
|
||||
|
||||
12
.github/workflows/test-urp.yml
vendored
12
.github/workflows/test-urp.yml
vendored
@@ -7,9 +7,9 @@ run-name: 🧪 Test URP (${{ github.event.pull_request.title || github.ref_name
|
||||
|
||||
env:
|
||||
# MINIMUM_VERSION: The minimum version of Unity.
|
||||
MINIMUM_VERSION: 6000.1
|
||||
MINIMUM_VERSION: 6000.0
|
||||
# EXCLUDE_FILTER: The excluded versions of Unity.
|
||||
EXCLUDE_FILTER: '(2020.2.0|2021.1|2023.3)'
|
||||
EXCLUDE_FILTER: "(2017|2018|2023.3)"
|
||||
PROJECT_PATH: ParticleEffectForUGUI_URP
|
||||
|
||||
on:
|
||||
@@ -85,10 +85,10 @@ jobs:
|
||||
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
|
||||
steps:
|
||||
- name: 🚚 Checkout ($${{ github.ref }})
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: 📥 Cache library
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: ${{ env.PROJECT_PATH }}/Library
|
||||
key: ${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
|
||||
@@ -97,7 +97,7 @@ jobs:
|
||||
${{ env.PROJECT_PATH }}-Library-
|
||||
|
||||
- name: 🛠️ Build Unity Project (Test)
|
||||
uses: game-ci/unity-builder@v5
|
||||
uses: game-ci/unity-builder@main
|
||||
timeout-minutes: 45
|
||||
with:
|
||||
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
@@ -111,7 +111,7 @@ jobs:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
# - name: 🧪 Run tests
|
||||
# uses: game-ci/unity-test-runner@v4
|
||||
# uses: game-ci/unity-test-runner@main
|
||||
# timeout-minutes: 45
|
||||
# with:
|
||||
# customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
|
||||
13
.github/workflows/test.yml
vendored
13
.github/workflows/test.yml
vendored
@@ -7,7 +7,7 @@ run-name: 🧪 Test (${{ github.event.pull_request.title || github.ref_name }})
|
||||
|
||||
env:
|
||||
# MINIMUM_VERSION: The minimum version of Unity.
|
||||
MINIMUM_VERSION: 2020.3
|
||||
MINIMUM_VERSION: 2019.4
|
||||
# EXCLUDE_FILTER: The excluded versions of Unity.
|
||||
EXCLUDE_FILTER: "(2017|2018|2023.3)"
|
||||
PROJECT_PATH: .
|
||||
@@ -45,7 +45,8 @@ jobs:
|
||||
steps:
|
||||
- name: 🔑 Secrets check
|
||||
run: |
|
||||
if [ -z "$UNITY_EMAIL" ] || [ -z "$UNITY_PASSWORD" ] || [ -z "UNITY_LICENSE" ]; then
|
||||
echo "Checking secrets for ${{ github.actor }} ..."
|
||||
if [ -z "$UNITY_EMAIL" ] || [ -z "$UNITY_PASSWORD" ] || [ -z "$UNITY_LICENSE" ]; then
|
||||
echo "Error: UNITY_EMAIL, UNITY_PASSWORD, and UNITY_LICENSE secrets must be set." | tee -a $GITHUB_STEP_SUMMARY >&2
|
||||
echo "Error: See https://game.ci/docs/github/test-runner#basic-setup" | tee -a $GITHUB_STEP_SUMMARY >&2
|
||||
echo "Error: Set the secrets at ${{ github.server_url }}/${{ github.repository }}/settings/secrets/actions" | tee -a $GITHUB_STEP_SUMMARY >&2
|
||||
@@ -84,10 +85,10 @@ jobs:
|
||||
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
|
||||
steps:
|
||||
- name: 🚚 Checkout ($${{ github.ref }})
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: 📥 Cache library
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: ${{ env.PROJECT_PATH }}/Library
|
||||
key: ${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
|
||||
@@ -96,7 +97,7 @@ jobs:
|
||||
${{ env.PROJECT_PATH }}-Library-
|
||||
|
||||
- name: 🛠️ Build Unity Project (Test)
|
||||
uses: game-ci/unity-builder@v5
|
||||
uses: game-ci/unity-builder@main
|
||||
timeout-minutes: 45
|
||||
with:
|
||||
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
@@ -110,7 +111,7 @@ jobs:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
- name: 🧪 Run tests
|
||||
uses: game-ci/unity-test-runner@v4
|
||||
uses: game-ci/unity-test-runner@main
|
||||
timeout-minutes: 45
|
||||
with:
|
||||
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
## [4.13.2](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.13.1...v4.13.2) (2026-06-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* support "disable domain reload" on Unity 6.6 or later ([dc12088](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/dc120884f68a5fee1775d039fc7bca0ee0e404b5))
|
||||
|
||||
## [4.13.1](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.13.0...v4.13.1) (2026-06-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* `ParticleSystemPreviewer` is no longer included in build ([bad976c](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/bad976cf01180bdabf5cd2f1760e069afdcb644a))
|
||||
* add support for Unity 6.7 ([26fd3da](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/26fd3da20b6b07f7a26df662358c53757a7cc5f5)), closes [#408](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/408)
|
||||
|
||||
# [4.13.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.12.2...v4.13.0) (2026-06-25)
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ You can render, mask, and sort your `ParticleSystems` for UI without the need fo
|
||||
- [Usage with `Mask` or `RectMask2D` Component](#usage-with-mask-or-rectmask2d-component)
|
||||
- [Usage with Script](#usage-with-script)
|
||||
- [Component: UIParticleAttractor](#component-uiparticleattractor)
|
||||
- [Component: ParticleSystemPreviewer](#component-particlesystempreviewer)
|
||||
- [Project Settings](#project-settings)
|
||||
- [🛠 Development Note](#-development-note)
|
||||
- [Compares the Baking mesh approach with the conventional approach](#compares-the-baking-mesh-approach-with-the-conventional-approach)
|
||||
@@ -116,7 +117,7 @@ _This package requires **Unity 2018.3 or later**._
|
||||
```
|
||||
- To update the package, use Package Manager UI (`Window > Package Manager`) or run the following command with `@{version}`:
|
||||
```
|
||||
openupm add com.coffee.ui-particle@4.9.0
|
||||
openupm add com.coffee.ui-particle@4.13.0
|
||||
```
|
||||
|
||||
#### Install via UPM (with Package Manager UI)
|
||||
@@ -125,7 +126,7 @@ _This package requires **Unity 2018.3 or later**._
|
||||
- Click `+ > Add package from git URL...` and input the repository URL: `https://github.com/mob-sakai/ParticleEffectForUGUI.git`
|
||||

|
||||
- To update the package, change suffix `#{version}` to the target version.
|
||||
- e.g. `https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.9.0`
|
||||
- e.g. `https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.13.0`
|
||||
|
||||
#### Install via UPM (Manually)
|
||||
|
||||
@@ -140,7 +141,7 @@ _This package requires **Unity 2018.3 or later**._
|
||||
```
|
||||
|
||||
- To update the package, change suffix `#{version}` to the target version.
|
||||
- e.g. `"com.coffee.ui-particle": "https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.9.0",`
|
||||
- e.g. `"com.coffee.ui-particle": "https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.13.0",`
|
||||
|
||||
#### Install as Embedded Package
|
||||
|
||||
@@ -271,16 +272,17 @@ uiParticle.Stop();
|
||||
- **Unscaled Time:** Update with unscaled delta time.
|
||||
- **OnAttracted**: An event called when attracting is complete (per particle).
|
||||
|
||||
|
||||
<br><br>
|
||||
|
||||
### Component: ParticleSystemPreviewer
|
||||
|
||||
`ParticleSystemPreviewer` is used to preview a ParticleSystem in the editor.
|
||||
`ParticleSystemPreviewer` is used to preview a `ParticleSystem` in the editor.
|
||||
|
||||

|
||||
|
||||
- When a `GameObject` with this component is selected in the editor, a temporary `ParticleSystem` is added if needed so you can preview the effect in the Scene view.
|
||||
- The generated `ParticleSystem` is marked with `HideFlags.DontSave`, so it is neither saved nor included in builds.
|
||||
|
||||
- This component will be removed in builds.
|
||||
|
||||
<br><br>
|
||||
|
||||
|
||||
153
Packages/src/Runtime/Internal/Extensions/MeshExtensions.cs
Normal file
153
Packages/src/Runtime/Internal/Extensions/MeshExtensions.cs
Normal file
@@ -0,0 +1,153 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIParticleInternal
|
||||
{
|
||||
internal static class MeshExtensions
|
||||
{
|
||||
internal static readonly InternalObjectPool<Mesh> s_MeshPool = new InternalObjectPool<Mesh>(
|
||||
() =>
|
||||
{
|
||||
var mesh = new Mesh
|
||||
{
|
||||
hideFlags = HideFlags.DontSave | HideFlags.NotEditable
|
||||
};
|
||||
mesh.MarkDynamic();
|
||||
return mesh;
|
||||
},
|
||||
mesh => mesh,
|
||||
mesh =>
|
||||
{
|
||||
if (mesh != null)
|
||||
{
|
||||
mesh.Clear();
|
||||
}
|
||||
});
|
||||
|
||||
public static Mesh Rent()
|
||||
{
|
||||
return s_MeshPool.Rent();
|
||||
}
|
||||
|
||||
public static void Return(ref Mesh mesh)
|
||||
{
|
||||
s_MeshPool.Return(ref mesh);
|
||||
}
|
||||
|
||||
public static void CopyTo(this Mesh self, Mesh dst)
|
||||
{
|
||||
if (self == null || dst == null) return;
|
||||
|
||||
var vector3List = InternalListPool<Vector3>.Rent();
|
||||
var vector4List = InternalListPool<Vector4>.Rent();
|
||||
var color32List = InternalListPool<Color32>.Rent();
|
||||
var intList = InternalListPool<int>.Rent();
|
||||
|
||||
dst.Clear(false);
|
||||
|
||||
self.GetVertices(vector3List);
|
||||
dst.SetVertices(vector3List);
|
||||
|
||||
self.GetTriangles(intList, 0);
|
||||
dst.SetTriangles(intList, 0);
|
||||
|
||||
self.GetNormals(vector3List);
|
||||
dst.SetNormals(vector3List);
|
||||
|
||||
self.GetTangents(vector4List);
|
||||
dst.SetTangents(vector4List);
|
||||
|
||||
self.GetColors(color32List);
|
||||
dst.SetColors(color32List);
|
||||
|
||||
self.GetUVs(0, vector4List);
|
||||
dst.SetUVs(0, vector4List);
|
||||
|
||||
self.GetUVs(1, vector4List);
|
||||
dst.SetUVs(1, vector4List);
|
||||
|
||||
self.GetUVs(2, vector4List);
|
||||
dst.SetUVs(2, vector4List);
|
||||
|
||||
self.GetUVs(3, vector4List);
|
||||
dst.SetUVs(3, vector4List);
|
||||
|
||||
dst.RecalculateBounds();
|
||||
InternalListPool<Vector3>.Return(ref vector3List);
|
||||
InternalListPool<Vector4>.Return(ref vector4List);
|
||||
InternalListPool<Color32>.Return(ref color32List);
|
||||
InternalListPool<int>.Return(ref intList);
|
||||
}
|
||||
|
||||
public static void CopyTo(this VertexHelper self, Mesh dst)
|
||||
{
|
||||
if (self == null || dst == null) return;
|
||||
|
||||
self.FillMesh(dst);
|
||||
}
|
||||
|
||||
public static void CopyTo(this Mesh self, VertexHelper dst)
|
||||
{
|
||||
if (self == null || dst == null) return;
|
||||
|
||||
var vertexCount = self.vertexCount;
|
||||
var indexCount = self.triangles.Length;
|
||||
self.CopyTo(dst, vertexCount, indexCount);
|
||||
}
|
||||
|
||||
public static void CopyTo(this Mesh self, VertexHelper dst, int vertexCount, int indexCount)
|
||||
{
|
||||
if (self == null || dst == null) return;
|
||||
|
||||
var positions = InternalListPool<Vector3>.Rent();
|
||||
var normals = InternalListPool<Vector3>.Rent();
|
||||
var uv0 = InternalListPool<Vector4>.Rent();
|
||||
var uv1 = InternalListPool<Vector4>.Rent();
|
||||
var uv2 = InternalListPool<Vector4>.Rent();
|
||||
var uv3 = InternalListPool<Vector4>.Rent();
|
||||
var tangents = InternalListPool<Vector4>.Rent();
|
||||
var colors = InternalListPool<Color32>.Rent();
|
||||
var indices = InternalListPool<int>.Rent();
|
||||
self.GetVertices(positions);
|
||||
self.GetColors(colors);
|
||||
self.GetUVs(0, uv0);
|
||||
self.GetUVs(1, uv1);
|
||||
self.GetUVs(2, uv1);
|
||||
self.GetUVs(3, uv1);
|
||||
self.GetNormals(normals);
|
||||
self.GetTangents(tangents);
|
||||
self.GetIndices(indices, 0);
|
||||
|
||||
dst.Clear();
|
||||
for (var i = 0; i < vertexCount; i++)
|
||||
{
|
||||
dst.AddVert(positions.GetOrDefault(i), colors.GetOrDefault(i), uv0.GetOrDefault(i), uv1.GetOrDefault(i),
|
||||
uv2.GetOrDefault(i), uv3.GetOrDefault(i), normals.GetOrDefault(i), tangents.GetOrDefault(i));
|
||||
}
|
||||
|
||||
var count = Mathf.Clamp(indexCount, 0, indices.Count);
|
||||
for (var i = 0; i < count - 2; i += 3)
|
||||
{
|
||||
dst.AddTriangle(indices[i], indices[i + 1], indices[i + 2]);
|
||||
}
|
||||
|
||||
InternalListPool<Vector3>.Return(ref positions);
|
||||
InternalListPool<Vector3>.Return(ref normals);
|
||||
InternalListPool<Vector4>.Return(ref uv0);
|
||||
InternalListPool<Vector4>.Return(ref uv1);
|
||||
InternalListPool<Vector4>.Return(ref uv2);
|
||||
InternalListPool<Vector4>.Return(ref uv3);
|
||||
InternalListPool<Vector4>.Return(ref tangents);
|
||||
InternalListPool<Color32>.Return(ref colors);
|
||||
InternalListPool<int>.Return(ref indices);
|
||||
}
|
||||
|
||||
private static T GetOrDefault<T>(this List<T> self, int index)
|
||||
{
|
||||
return 0 <= index && index < self.Count
|
||||
? self[index]
|
||||
: default;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c949d47f5c6d4d22bd7baebc60d48f3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -59,21 +59,6 @@ namespace Coffee.UIParticleInternal
|
||||
s_BuildingPlayer = false;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void OnDomainReload()
|
||||
{
|
||||
foreach (var t in TypeCache.GetTypesDerivedFrom(typeof(PreloadedProjectSettings<>)))
|
||||
{
|
||||
var defaultSettings = GetDefaultSettings(t);
|
||||
if (defaultSettings != null)
|
||||
{
|
||||
defaultSettings.OnDomainReload();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private static void Initialize()
|
||||
@@ -166,10 +151,6 @@ namespace Coffee.UIParticleInternal
|
||||
protected virtual void OnInitialize()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void OnDomainReload()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract class PreloadedProjectSettingsEditor : Editor
|
||||
@@ -255,11 +236,6 @@ namespace Coffee.UIParticleInternal
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDomainReload()
|
||||
{
|
||||
s_Instance = null;
|
||||
}
|
||||
#else
|
||||
public static T instance => s_Instance != null ? s_Instance : s_Instance = CreateInstance<T>();
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Coffee.UIParticleInternal
|
||||
@@ -9,6 +10,7 @@ namespace Coffee.UIParticleInternal
|
||||
private static readonly Dictionary<Type, IFrameCache> s_Caches = new Dictionary<Type, IFrameCache>();
|
||||
|
||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||
[InitializeOnLoadMethod]
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
#elif UNITY_EDITOR
|
||||
[InitializeOnLoadMethod]
|
||||
|
||||
@@ -18,12 +18,6 @@ namespace Coffee.UIParticleInternal
|
||||
private static readonly FastAction s_OnScreenSizeChangedAction = new FastAction();
|
||||
private static Vector2Int s_LastScreenSize;
|
||||
|
||||
static UIExtraCallbacks()
|
||||
{
|
||||
Canvas.willRenderCanvases += OnBeforeCanvasRebuild;
|
||||
Logger.LogMulticast(typeof(Canvas), "willRenderCanvases", message: "ctor");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event that occurs after canvas rebuilds.
|
||||
/// </summary>
|
||||
@@ -72,7 +66,7 @@ namespace Coffee.UIParticleInternal
|
||||
CanvasUpdateRegistry.IsRebuildingLayout();
|
||||
#if TMP_ENABLE
|
||||
// Explicitly set `Canvas.willRenderCanvases += TMP_UpdateManager.DoRebuilds`.
|
||||
typeof(TMPro.TMP_UpdateManager)
|
||||
var _ = typeof(TMPro.TMP_UpdateManager)
|
||||
.GetProperty("instance", BindingFlags.NonPublic | BindingFlags.Static)
|
||||
.GetValue(null);
|
||||
#endif
|
||||
@@ -83,6 +77,7 @@ namespace Coffee.UIParticleInternal
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||
[InitializeOnLoadMethod]
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
#elif UNITY_EDITOR
|
||||
[InitializeOnLoadMethod]
|
||||
@@ -91,9 +86,17 @@ namespace Coffee.UIParticleInternal
|
||||
#endif
|
||||
private static void InitializeOnLoad()
|
||||
{
|
||||
#if UNITY_2019_4 || UNITY_2020_2_OR_NEWER
|
||||
Canvas.preWillRenderCanvases -= OnBeforeCanvasRebuild;
|
||||
Canvas.preWillRenderCanvases += OnBeforeCanvasRebuild;
|
||||
#else
|
||||
Canvas.willRenderCanvases -= OnBeforeCanvasRebuild;
|
||||
Canvas.willRenderCanvases += OnBeforeCanvasRebuild;
|
||||
#endif
|
||||
Canvas.willRenderCanvases -= OnAfterCanvasRebuild;
|
||||
s_IsInitializedAfterCanvasRebuild = false;
|
||||
s_LastScreenSize = default;
|
||||
Logger.LogMulticast(typeof(Canvas), "willRenderCanvases", message: "ctor");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Coffee.UIParticleInternal;
|
||||
@@ -13,7 +14,6 @@ namespace Coffee.UIExtensions
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[CustomEditor(typeof(ParticleSystemPreviewer))]
|
||||
[CanEditMultipleObjects]
|
||||
internal class ParticleSystemPreviewerEditor : Editor
|
||||
@@ -29,6 +29,7 @@ namespace Coffee.UIExtensions
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
EditorGUILayout.HelpBox("ParticleSystemPreviewer will be removed in build.", MessageType.Warning);
|
||||
ParticleSystemPreviewSystem.DrawWarningForTemporary(_gameObjects);
|
||||
ParticleSystemPreviewSystem.DrawWarningForPermanent(_gameObjects);
|
||||
}
|
||||
@@ -43,6 +44,12 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
private const HideFlags k_TemporaryHideFlags = HideFlags.DontSave | HideFlags.NotEditable;
|
||||
|
||||
private const string k_TemporaryMesssage = "The temporary ParticleSystem for preview is attached.\n" +
|
||||
"It will be removed when exiting edit mode.";
|
||||
|
||||
private const string k_PermanentMesssage = "The permanent ParticleSystem is attached.\n" +
|
||||
"It will be included in build.";
|
||||
|
||||
[SerializeField]
|
||||
private List<GameObject> m_PreviewObjects = new List<GameObject>();
|
||||
|
||||
@@ -192,8 +199,7 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
if (gameObjects == null || gameObjects.Length == 0 || !gameObjects.Any(HasTemporaryParticleSystem)) return;
|
||||
|
||||
if (WarningButton("The temporary ParticleSystem for preview is attached.\n" +
|
||||
"It will be removed when exiting edit mode.", "Remove"))
|
||||
if (HelpBoxButton(MessageType.Warning, k_TemporaryMesssage, "Remove"))
|
||||
{
|
||||
foreach (var go in gameObjects)
|
||||
{
|
||||
@@ -209,8 +215,7 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
if (gameObjects == null || gameObjects.Length == 0 || !gameObjects.Any(HasPermanentParticleSystem)) return;
|
||||
|
||||
if (WarningButton("The permanent ParticleSystem is attached.\n" +
|
||||
"It will be included in build.", "Remove"))
|
||||
if (HelpBoxButton(MessageType.Info, k_PermanentMesssage, "Remove"))
|
||||
{
|
||||
foreach (var go in gameObjects)
|
||||
{
|
||||
@@ -224,14 +229,14 @@ namespace Coffee.UIExtensions
|
||||
}
|
||||
}
|
||||
|
||||
private static bool WarningButton(string message, string buttonText)
|
||||
private static bool HelpBoxButton(MessageType messageType, string message, string buttonText)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.HelpBox(message, MessageType.Warning, true);
|
||||
EditorGUILayout.HelpBox(message, messageType, true);
|
||||
var clicked = GUILayout.Button(EditorGUIUtility.TrTempContent(buttonText));
|
||||
EditorGUILayout.EndHorizontal();
|
||||
return clicked;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Coffee.UIExtensions
|
||||
private static readonly List<Material> s_Materials = new List<Material>(2);
|
||||
private static MaterialPropertyBlock s_Mpb;
|
||||
private static readonly Vector3[] s_Corners = new Vector3[4];
|
||||
private static readonly VertexHelper s_VertexHelper = new VertexHelper();
|
||||
private bool _delay;
|
||||
private int _index;
|
||||
private bool _isPrevStored;
|
||||
@@ -451,11 +452,15 @@ namespace Coffee.UIExtensions
|
||||
|
||||
var components = InternalListPool<Component>.Rent();
|
||||
GetComponents(typeof(IMeshModifier), components);
|
||||
if (0 < components.Count)
|
||||
{
|
||||
workerMesh.CopyTo(s_VertexHelper);
|
||||
for (var i = 0; i < components.Count; i++)
|
||||
{
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
((IMeshModifier)components[i]).ModifyMesh(workerMesh);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
((IMeshModifier)components[i]).ModifyMesh(s_VertexHelper);
|
||||
}
|
||||
|
||||
s_VertexHelper.FillMesh(workerMesh);
|
||||
}
|
||||
|
||||
InternalListPool<Component>.Return(ref components);
|
||||
|
||||
@@ -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.13.0",
|
||||
"version": "4.13.2",
|
||||
"unity": "2018.2",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user