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
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6394eee4de | ||
|
|
1f1fb2a62a | ||
|
|
640cee9e34 | ||
|
|
9dedbfb48f | ||
|
|
3849a9f697 | ||
|
|
69bde2cf3d | ||
|
|
a10042d989 | ||
|
|
dd2d185e4a | ||
|
|
e817e8d3c7 | ||
|
|
aaac2b71a3 | ||
|
|
11c3a7b374 | ||
|
|
ccc09e6aca | ||
|
|
5a8f1263ef | ||
|
|
b6b2c72b19 | ||
|
|
0fd5d7affe | ||
|
|
2e4d80bc1c | ||
|
|
6b87db7ac7 | ||
|
|
61760d940c | ||
|
|
f43d4c38ea | ||
|
|
ccb8386672 | ||
|
|
e15319a46e | ||
|
|
e352d153ce | ||
|
|
4f9bbf57bc | ||
|
|
0b9d80da93 | ||
|
|
24d32d8441 | ||
|
|
476c4027ff | ||
|
|
12c748a8cd | ||
|
|
0259ad2464 | ||
|
|
5f3ead2086 | ||
|
|
e3f42d747a | ||
|
|
b93e0e4701 | ||
|
|
9f9e04724d | ||
|
|
5981af6c0a | ||
|
|
f38240f527 | ||
|
|
d775e805fb | ||
|
|
d9eb91c120 | ||
|
|
13223b2d74 | ||
|
|
d5ce78ae5a | ||
|
|
3bb5241275 | ||
|
|
41e895a2db | ||
|
|
17ce81eb0e | ||
|
|
ba3b80db7a | ||
|
|
2a1f3345ba | ||
|
|
c0aa89bd6f | ||
|
|
501aa7b7f1 | ||
|
|
9313489552 | ||
|
|
63b36a45b9 | ||
|
|
087dbe99b9 | ||
|
|
d11cd0a06d |
13
.github/workflows/release.yml
vendored
13
.github/workflows/release.yml
vendored
@@ -5,19 +5,20 @@ on:
|
||||
branches:
|
||||
- preview
|
||||
- main
|
||||
- v*.x
|
||||
- "*.x"
|
||||
tags-ignore:
|
||||
- "**"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
if: "! contains(github.event.head_commit.message, '[skip ci]') && ! contains(github.event.head_commit.message, '[ci skip]')"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- run: |
|
||||
npm i --no-save https://gist.github.com/mob-sakai/c90044338361af97a7e8c8a78425bdb3
|
||||
npx semantic-release -e @mob-sakai/semantic-release-upm
|
||||
- uses: cycjimmy/semantic-release-action@v3
|
||||
with:
|
||||
extra_plugins: |
|
||||
@semantic-release/changelog
|
||||
@semantic-release/git
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
94
.github/workflows/test.yml
vendored
Normal file
94
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
# Secrets
|
||||
# UNITY_LICENSE:
|
||||
name: test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
tags:
|
||||
- "!*"
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
|
||||
jobs:
|
||||
unity-test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
unityVersion: [
|
||||
"2018.3.14f1",
|
||||
"2018.4.30f1",
|
||||
"2019.1.14f1",
|
||||
"2019.2.21f1",
|
||||
"2019.3.15f1",
|
||||
"2019.4.16f1",
|
||||
"2020.1.17f1",
|
||||
"2020.2.1f1",
|
||||
]
|
||||
|
||||
steps:
|
||||
# Checkout sandbox project
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: sandbox
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
|
||||
# Update package submodule
|
||||
- name: "Update package submodule"
|
||||
working-directory: Packages/dev
|
||||
run: git checkout ${{ github.sha }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.unityVersion }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
Library-${{ matrix.unityVersion }}-
|
||||
Library-
|
||||
|
||||
# Install codecoverage package
|
||||
- name: "Install codecoverage package"
|
||||
if: startsWith(matrix.unityVersion, '2019.4.')
|
||||
run: |
|
||||
npx openupm-cli add -f com.unity.testtools.codecoverage@0.4.0-preview
|
||||
|
||||
# Run tests
|
||||
- name: "Run tests"
|
||||
uses: game-ci/unity-test-runner@main
|
||||
with:
|
||||
unityVersion: ${{ matrix.unityVersion }}
|
||||
customParameters: -nographics -enableCodeCoverage -coverageOptions assemblyFilters:+Coffee.UIParticle.*Tests
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: always()
|
||||
with:
|
||||
name: TestResults-${{ matrix.unityVersion }}
|
||||
path: |
|
||||
artifacts/*.xml
|
||||
CodeCoverage/**/TestCoverageResults_*.xml
|
||||
|
||||
publish:
|
||||
needs: unity-test
|
||||
runs-on: ubuntu-latest
|
||||
if: always()
|
||||
steps:
|
||||
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- uses: testspace-com/setup-testspace@v1
|
||||
with:
|
||||
domain: ${{github.repository_owner}}
|
||||
|
||||
- name: Push test results
|
||||
if: always()
|
||||
run: |
|
||||
testspace `find . -name '*.xml' | tr '\n' ' '`
|
||||
100
.github/workflows/unity-test.yml
vendored
100
.github/workflows/unity-test.yml
vendored
@@ -1,100 +0,0 @@
|
||||
name: unity-test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
tags:
|
||||
- "!*"
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
|
||||
jobs:
|
||||
unity-test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
unity:
|
||||
[
|
||||
"2018.3.14f1",
|
||||
"2018.4.25f1",
|
||||
"2019.1.14f1",
|
||||
"2019.2.11f1",
|
||||
"2019.3.15f1",
|
||||
"2019.4.8f1",
|
||||
"2020.1.5f1",
|
||||
]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
# Use Unity image from https://hub.docker.com/r/gableroux/unity3d/tags
|
||||
image: gableroux/unity3d:${{ matrix.unity }}
|
||||
|
||||
steps:
|
||||
# Activate Unity Editor
|
||||
- name: Activate Unity Editor
|
||||
id: activation
|
||||
run: |
|
||||
apt-get update > /dev/null
|
||||
apt-get install software-properties-common -y > /dev/null
|
||||
apt-add-repository ppa:git-core/ppa -y > /dev/null
|
||||
apt-get update > /dev/null
|
||||
apt-get install git -y > /dev/null
|
||||
git clone https://gist.github.com/135c940b45ec4e385861c8711777db7f.git .ulfs
|
||||
chmod 755 .ulfs/activate.sh && .ulfs/activate.sh ${{ matrix.unity }}
|
||||
|
||||
# (On failed activation) Upload unity activation file
|
||||
- name: Upload unity activation file
|
||||
uses: actions/upload-artifact@v2
|
||||
if: failure()
|
||||
with:
|
||||
name: Unity_v${{ matrix.unity }}.alf
|
||||
path: ./*.alf
|
||||
|
||||
# Checkout sandbox project
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: "sandbox"
|
||||
submodules: "true"
|
||||
|
||||
# Update package submodule
|
||||
- name: "Update package submodule"
|
||||
working-directory: Packages/dev
|
||||
run: git checkout ${{ github.head_ref }}
|
||||
|
||||
# Install codecoverage package
|
||||
- name: "Install codecoverage package"
|
||||
if: always() && steps.activation.conclusion == 'success'
|
||||
run: |
|
||||
[ -n "`echo ${{ matrix.unity }} | grep -e '\(2017.\|2018.\|2019.1.\|2019.2.\)'`" ] && exit 0
|
||||
npm i -g openupm-cli
|
||||
openupm add com.unity.testtools.codecoverage
|
||||
|
||||
# Run playmode tests
|
||||
- name: "Run playmode tests"
|
||||
if: always() && steps.activation.conclusion == 'success'
|
||||
run: |
|
||||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
||||
/opt/Unity/Editor/Unity -batchmode -nographics -silent-crashes -logFile -projectPath . \
|
||||
-runTests -testPlatform playmode -enableCodeCoverage
|
||||
|
||||
# Run editmode tests
|
||||
- name: "Run editmode tests"
|
||||
if: always() && steps.activation.conclusion == 'success'
|
||||
run: |
|
||||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
||||
/opt/Unity/Editor/Unity -batchmode -nographics -silent-crashes -logFile -projectPath . \
|
||||
-runTests -testPlatform editmode -enableCodeCoverage
|
||||
|
||||
# Setup testspace
|
||||
- uses: testspace-com/setup-testspace@v1
|
||||
if: always() && steps.activation.conclusion == 'success'
|
||||
with:
|
||||
domain: ${{ github.repository_owner }}
|
||||
|
||||
# Push test results
|
||||
- name: Push test results
|
||||
if: always() && steps.activation.conclusion == 'success'
|
||||
run: testspace "[${{ matrix.unity }}]TestResults-*.xml" "[Code Coverage]CodeCoverage/**/TestCoverageResults_*.xml"
|
||||
25
.releaserc.json
Normal file
25
.releaserc.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"branches": [
|
||||
"+([0-9])?(.{+([0-9]),x}).x",
|
||||
"master",
|
||||
"main",
|
||||
{
|
||||
"name": "preview",
|
||||
"prerelease": true
|
||||
}
|
||||
],
|
||||
"tagFormat": "${version}",
|
||||
"plugins": [
|
||||
"@semantic-release/commit-analyzer",
|
||||
"@semantic-release/release-notes-generator",
|
||||
"@semantic-release/changelog",
|
||||
[
|
||||
"@semantic-release/npm",
|
||||
{
|
||||
"npmPublish": false
|
||||
}
|
||||
],
|
||||
"@semantic-release/git",
|
||||
"@semantic-release/github"
|
||||
]
|
||||
}
|
||||
107
CHANGELOG.md
107
CHANGELOG.md
@@ -1,3 +1,110 @@
|
||||
## [3.3.14](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.13...3.3.14) (2023-08-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* error on InitializeIfNeeded ([1f1fb2a](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/1f1fb2a62a9d2ca6562e1b1e70d528aaf52bfc82)), closes [#264](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/264)
|
||||
|
||||
## [3.3.13](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.12...3.3.13) (2023-05-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* memory leak when using AnimatableProperty ([3849a9f](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/3849a9f6977bc6d2474001c8154a8e201f7e8b7b))
|
||||
|
||||
## [3.3.12](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.11...3.3.12) (2022-06-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* always display materials in inspector ([a10042d](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/a10042d989dea18ff010bdbe970aa434e2bdf117))
|
||||
* UNITY_UI_ALPHACLIP in UIAdditive shader is not working ([e817e8d](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/e817e8d3c75188f3243243855b135bd840699199))
|
||||
|
||||
## [3.3.11](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.10...3.3.11) (2022-06-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* sorting by layer does not work properly ([ccc09e6](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/ccc09e6aca2fa3d7bc887e6c733e66706e40ae0f))
|
||||
* when using linear color space, the particle colors are not output correctly ([11c3a7b](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/11c3a7b37415d78e1b8ba3988a6e043c9f1861e0)), closes [#203](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/203)
|
||||
|
||||
## [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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* In rare cases, the generated camera (for baking) will not be deactivated ([12c748a](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/12c748a8cd4adfd2dc5f085cec77050431f261a4))
|
||||
* remove from "Add Component" menu ([476c402](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/476c4027ff5f70fb9b4c026dd5fc59bf5a876227))
|
||||
|
||||
## [3.3.5](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.4...3.3.5) (2021-02-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix cached position for pre-warmed particles ([e3f42d7](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/e3f42d747a7fd973b5813cc72a9444943a6c3ad0))
|
||||
* ParticleSystem creates particles in wrong position during pre-warm ([b93e0e4](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/b93e0e4701c7011176eeec5c109dda7f4ea632e0)), closes [#147](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/147)
|
||||
|
||||
## [3.3.4](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.3...3.3.4) (2021-02-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Multiselecting sets all scales to the same value ([13223b2](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/13223b2d747609cf88b424ad590bda7f857b387d))
|
||||
* support sub emitter with 'PlayOnAwake' ([d5ce78a](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/d5ce78ae5acf2740ba7fdc6cde9f197c4e165484))
|
||||
* The maximum material count is 8 ([3bb5241](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/3bb52412751360409747192150188ae904f2c3d3))
|
||||
|
||||
## [3.3.3](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.2...3.3.3) (2021-02-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* particle trails draw in wrong transform ([17ce81e](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/17ce81eb0eccb103c21fa553183df97429cf5c6f)), closes [#145](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/145)
|
||||
|
||||
## [3.3.2](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.1...3.3.2) (2021-02-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* _cachedPosition defaults to localPosition ([c0aa89b](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/c0aa89bd6f7847723a4702b6ca70fa202e8a8304)), closes [#121](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/121)
|
||||
* submeshes can't over 8 ([2a1f334](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/2a1f3345bacdecf38e8890781a181a1392224e35)), closes [#122](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/122)
|
||||
|
||||
## [3.3.1](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.0...3.3.1) (2021-02-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ignore material check and transform check ([d11cd0a](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/d11cd0a06d76a32b2a119387bddc34c703b9b497)), closes [#119](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/119)
|
||||
* the trail is incorrect in SimulationSpace.Local ([9313489](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/9313489552b30f2e2b0b42a641f5e0502995b03d))
|
||||
|
||||
# [3.3.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.2.0...3.3.0) (2020-11-20)
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using UnityEngine.UI;
|
||||
namespace Coffee.UIExtensions.Demos
|
||||
{
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
[ExecuteInEditMode]
|
||||
[ExecuteAlways]
|
||||
[RequireComponent(typeof(CanvasRenderer), typeof(ParticleSystem))]
|
||||
public class UIParticleSystem_Demo : MaskableGraphic
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Coffee.UIParticleExtensions
|
||||
{
|
||||
[AddComponentMenu("")]
|
||||
internal class BakingCamera : MonoBehaviour
|
||||
{
|
||||
static BakingCamera s_Instance;
|
||||
@@ -16,7 +17,11 @@ namespace Coffee.UIParticleExtensions
|
||||
get
|
||||
{
|
||||
// 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();
|
||||
#endif
|
||||
if (prefabStage == null || !prefabStage.scene.isLoaded) return null;
|
||||
if (s_InstanceForPrefab) return s_InstanceForPrefab;
|
||||
|
||||
@@ -40,12 +45,11 @@ namespace Coffee.UIParticleExtensions
|
||||
// Find instance in scene, or create new one.
|
||||
return s_Instance
|
||||
? s_Instance
|
||||
: (s_Instance = FindObjectOfType<BakingCamera>() ?? Create());
|
||||
: (s_Instance = Create());
|
||||
}
|
||||
}
|
||||
|
||||
private Camera _camera;
|
||||
// private int _refCount;
|
||||
|
||||
private static BakingCamera Create()
|
||||
{
|
||||
@@ -56,6 +60,7 @@ namespace Coffee.UIParticleExtensions
|
||||
|
||||
var inst = gameObject.AddComponent<BakingCamera>();
|
||||
inst._camera = gameObject.AddComponent<Camera>();
|
||||
inst._camera.enabled = false;
|
||||
inst._camera.orthographic = true;
|
||||
|
||||
// Turn camera off because particle mesh baker will use only camera matrix
|
||||
|
||||
@@ -22,8 +22,6 @@ namespace Coffee.UIExtensions
|
||||
private static readonly GUIContent s_ContentTrailMaterial = new GUIContent("Trail Material");
|
||||
private static readonly GUIContent s_Content3D = new GUIContent("3D");
|
||||
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 _spScale;
|
||||
@@ -32,8 +30,7 @@ namespace Coffee.UIExtensions
|
||||
private SerializedProperty _spShrinkByMaterial;
|
||||
|
||||
private ReorderableList _ro;
|
||||
private bool _xyzMode;
|
||||
private bool _showMaterials;
|
||||
static private bool _xyzMode;
|
||||
|
||||
private static readonly List<string> s_MaskablePropertyNames = new List<string>
|
||||
{
|
||||
@@ -60,14 +57,11 @@ namespace Coffee.UIExtensions
|
||||
_spIgnoreCanvasScaler = serializedObject.FindProperty("m_IgnoreCanvasScaler");
|
||||
_spAnimatableProperties = serializedObject.FindProperty("m_AnimatableProperties");
|
||||
_spShrinkByMaterial = serializedObject.FindProperty("m_ShrinkByMaterial");
|
||||
_showMaterials = EditorPrefs.GetBool("Coffee.UIExtensions.UIParticleEditor._showMaterials", true);
|
||||
|
||||
var sp = serializedObject.FindProperty("m_Particles");
|
||||
_ro = new ReorderableList(sp.serializedObject, sp, true, true, true, true);
|
||||
_ro.elementHeight = EditorGUIUtility.singleLineHeight * 3 + 4;
|
||||
_ro.elementHeightCallback = _ => _showMaterials
|
||||
? 3 * (EditorGUIUtility.singleLineHeight + 2)
|
||||
: EditorGUIUtility.singleLineHeight + 2;
|
||||
_ro.elementHeightCallback = _ => 3 * (EditorGUIUtility.singleLineHeight + 2);
|
||||
_ro.drawElementCallback = (rect, index, active, focused) =>
|
||||
{
|
||||
EditorGUI.BeginDisabledGroup(sp.hasMultipleDifferentValues);
|
||||
@@ -75,8 +69,6 @@ namespace Coffee.UIExtensions
|
||||
rect.height = EditorGUIUtility.singleLineHeight;
|
||||
var p = sp.GetArrayElementAtIndex(index);
|
||||
EditorGUI.ObjectField(rect, p, GUIContent.none);
|
||||
if (!_showMaterials) return;
|
||||
|
||||
rect.x += 15;
|
||||
rect.width -= 15;
|
||||
var ps = p.objectReferenceValue as ParticleSystem;
|
||||
@@ -100,9 +92,6 @@ namespace Coffee.UIExtensions
|
||||
#endif
|
||||
EditorGUI.LabelField(new Rect(rect.x, rect.y, 150, rect.height), s_ContentRenderingOrder);
|
||||
|
||||
var content = EditorGUIUtility.IconContent(_showMaterials ? "VisibilityOn" : "VisibilityOff");
|
||||
_showMaterials = GUI.Toggle(new Rect(rect.width - 55, rect.y, 24, 20), _showMaterials, content, EditorStyles.label);
|
||||
|
||||
if (GUI.Button(new Rect(rect.width - 35, rect.y, 60, rect.height), s_ContentRefresh, EditorStyles.miniButton))
|
||||
{
|
||||
foreach (UIParticle t in targets)
|
||||
@@ -205,17 +194,22 @@ namespace Coffee.UIExtensions
|
||||
return;
|
||||
}
|
||||
|
||||
current.GetComponentsInParent(true, s_TempParents);
|
||||
if (FixButton(1 < s_TempParents.Count, "This UIParticle component should be removed. The parent UIParticle exists."))
|
||||
// #203: When using linear color space, the particle colors are not output correctly.
|
||||
// To fix, set 'Apply Active Color Space' in renderer module to false.
|
||||
var allPsRenderers = targets.OfType<UIParticle>()
|
||||
.SelectMany(x => x.particles)
|
||||
.Where(x => x)
|
||||
.Select(x => x.GetComponent<ParticleSystemRenderer>())
|
||||
.ToArray();
|
||||
if (0 < allPsRenderers.Length)
|
||||
{
|
||||
DestroyUIParticle(current);
|
||||
return;
|
||||
}
|
||||
|
||||
current.GetComponentsInChildren(true, s_TempChildren);
|
||||
if (FixButton(1 < s_TempChildren.Count, "The children UIParticle component should be removed."))
|
||||
{
|
||||
s_TempChildren.ForEach(child => DestroyUIParticle(child, true));
|
||||
var so = new SerializedObject(allPsRenderers);
|
||||
var sp = so.FindProperty("m_ApplyActiveColorSpace");//.boolValue = false;
|
||||
if (FixButton(sp.boolValue || sp.hasMultipleDifferentValues, "When using linear color space, the particle colors are not output correctly.\nTo fix, set 'Apply Active Color Space' in renderer module to false."))
|
||||
{
|
||||
sp.boolValue = false;
|
||||
so.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,11 +221,20 @@ namespace Coffee.UIExtensions
|
||||
DestroyImmediate(p);
|
||||
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();
|
||||
#endif
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
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
|
||||
}
|
||||
@@ -263,20 +266,27 @@ namespace Coffee.UIExtensions
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (showXyz)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(sp);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
x.floatValue = Mathf.Max(0.001f, x.floatValue);
|
||||
y.floatValue = Mathf.Max(0.001f, y.floatValue);
|
||||
z.floatValue = Mathf.Max(0.001f, z.floatValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.PropertyField(x, s_ContentScale);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
z.floatValue = y.floatValue = x.floatValue;
|
||||
{
|
||||
x.floatValue = Mathf.Max(0.001f, x.floatValue);
|
||||
y.floatValue = Mathf.Max(0.001f, x.floatValue);
|
||||
z.floatValue = Mathf.Max(0.001f, x.floatValue);
|
||||
}
|
||||
}
|
||||
|
||||
x.floatValue = Mathf.Max(0.001f, x.floatValue);
|
||||
y.floatValue = Mathf.Max(0.001f, y.floatValue);
|
||||
z.floatValue = Mathf.Max(0.001f, z.floatValue);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
showXyz = GUILayout.Toggle(showXyz, s_Content3D, EditorStyles.miniButton, GUILayout.Width(30));
|
||||
if (EditorGUI.EndChangeCheck() && !showXyz)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#if UNITY_2019_3_11 || UNITY_2019_3_12 || UNITY_2019_3_13 || UNITY_2019_3_14 || UNITY_2019_3_15 || UNITY_2019_4_OR_NEWER
|
||||
#define SERIALIZE_FIELD_MASKABLE
|
||||
#endif
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Coffee.UIParticleExtensions;
|
||||
@@ -16,7 +17,7 @@ namespace Coffee.UIExtensions
|
||||
/// <summary>
|
||||
/// Render maskable and sortable particle effect ,without Camera, RenderTexture or Canvas.
|
||||
/// </summary>
|
||||
[ExecuteInEditMode]
|
||||
[ExecuteAlways]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
[RequireComponent(typeof(CanvasRenderer))]
|
||||
public class UIParticle : MaskableGraphic
|
||||
@@ -60,6 +61,7 @@ namespace Coffee.UIExtensions
|
||||
private static readonly List<Material> s_PrevMaskMaterials = new List<Material>();
|
||||
private static readonly List<Material> s_PrevModifiedMaterials = new List<Material>();
|
||||
private static readonly List<Component> s_Components = new List<Component>();
|
||||
private static readonly List<ParticleSystem> s_ParticleSystems = new List<ParticleSystem>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -176,6 +178,11 @@ namespace Coffee.UIExtensions
|
||||
particles.Exec(p => p.Stop());
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
particles.Exec(p => p.Clear());
|
||||
}
|
||||
|
||||
public void SetParticleSystemInstance(GameObject instance)
|
||||
{
|
||||
SetParticleSystemInstance(instance, true);
|
||||
@@ -222,6 +229,7 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
if (!root) return;
|
||||
root.GetComponentsInChildren(particles);
|
||||
particles.RemoveAll(x => x.GetComponentInParent<UIParticle>() != this);
|
||||
|
||||
foreach (var ps in particles)
|
||||
{
|
||||
@@ -265,7 +273,7 @@ namespace Coffee.UIExtensions
|
||||
|
||||
//
|
||||
GetComponents(typeof(IMaterialModifier), s_Components);
|
||||
var materialCount = Mathf.Max(8, count);
|
||||
var materialCount = Mathf.Min(8, count);
|
||||
canvasRenderer.materialCount = materialCount;
|
||||
var j = 0;
|
||||
for (var i = 0; i < particles.Count; i++)
|
||||
@@ -305,6 +313,20 @@ namespace Coffee.UIExtensions
|
||||
ClearPreviousMaterials();
|
||||
}
|
||||
|
||||
private void ClearMaterials()
|
||||
{
|
||||
// Clear mask materials.
|
||||
s_PrevMaskMaterials.AddRange(_maskMaterials);
|
||||
_maskMaterials.Clear();
|
||||
|
||||
// Clear modified materials.
|
||||
s_PrevModifiedMaterials.AddRange(_modifiedMaterials);
|
||||
_modifiedMaterials.Clear();
|
||||
|
||||
canvasRenderer.Clear();
|
||||
ClearPreviousMaterials();
|
||||
}
|
||||
|
||||
private void ClearPreviousMaterials()
|
||||
{
|
||||
foreach (var m in s_PrevMaskMaterials)
|
||||
@@ -387,7 +409,6 @@ namespace Coffee.UIExtensions
|
||||
#if !SERIALIZE_FIELD_MASKABLE
|
||||
maskable = m_Maskable;
|
||||
#endif
|
||||
_cachedPosition = transform.localPosition;
|
||||
activeMeshIndices.Clear();
|
||||
|
||||
UIParticleUpdater.Register(this);
|
||||
@@ -406,6 +427,25 @@ namespace Coffee.UIExtensions
|
||||
InitializeIfNeeded();
|
||||
}
|
||||
|
||||
private new IEnumerator Start()
|
||||
{
|
||||
// #147: ParticleSystem creates Particles in wrong position during prewarm
|
||||
// #148: Particle Sub Emitter not showing when start game
|
||||
var delayToPlay = particles.AnyFast(ps =>
|
||||
{
|
||||
ps.GetComponentsInChildren(false, s_ParticleSystems);
|
||||
return s_ParticleSystems.AnyFast(p => p.isPlaying && (p.subEmitters.enabled || p.main.prewarm));
|
||||
});
|
||||
s_ParticleSystems.Clear();
|
||||
if (!delayToPlay) yield break;
|
||||
|
||||
Stop();
|
||||
Clear();
|
||||
yield return null;
|
||||
|
||||
Play();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function is called when the behaviour becomes disabled.
|
||||
/// </summary>
|
||||
@@ -421,6 +461,7 @@ namespace Coffee.UIExtensions
|
||||
_bakedMesh = null;
|
||||
|
||||
base.OnDisable();
|
||||
ClearMaterials();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -439,6 +480,7 @@ namespace Coffee.UIExtensions
|
||||
|
||||
private void InitializeIfNeeded()
|
||||
{
|
||||
if (!this) return;
|
||||
if (enabled && m_IsTrail)
|
||||
{
|
||||
UnityEngine.Debug.LogWarningFormat(this, "[UIParticle] The UIParticle component should be removed: {0}\nReason: UIParticle for trails is no longer needed.", name);
|
||||
@@ -447,14 +489,6 @@ namespace Coffee.UIExtensions
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
else if (enabled && transform.parent && transform.parent.GetComponentInParent<UIParticle>())
|
||||
{
|
||||
UnityEngine.Debug.LogWarningFormat(this, "[UIParticle] The UIParticle component should be removed: {0}\nReason: The parent UIParticle exists.", name);
|
||||
gameObject.hideFlags = HideFlags.None;
|
||||
_shouldBeRemoved = true;
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this || particles.AnyFast()) return;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Coffee.UIExtensions
|
||||
static readonly List<UIParticle> s_ActiveParticles = new List<UIParticle>();
|
||||
static MaterialPropertyBlock s_Mpb;
|
||||
static ParticleSystem.Particle[] s_Particles = new ParticleSystem.Particle[2048];
|
||||
private static int frameCount = 0;
|
||||
|
||||
|
||||
public static void Register(UIParticle particle)
|
||||
@@ -41,6 +42,10 @@ namespace Coffee.UIExtensions
|
||||
|
||||
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");
|
||||
for (var i = 0; i < s_ActiveParticles.Count; i++)
|
||||
{
|
||||
@@ -69,12 +74,12 @@ namespace Coffee.UIExtensions
|
||||
BakeMesh(particle);
|
||||
Profiler.EndSample();
|
||||
|
||||
if (QualitySettings.activeColorSpace == ColorSpace.Linear)
|
||||
{
|
||||
Profiler.BeginSample("[UIParticle] Modify color space to linear");
|
||||
particle.bakedMesh.ModifyColorSpaceToLinear();
|
||||
Profiler.EndSample();
|
||||
}
|
||||
// if (QualitySettings.activeColorSpace == ColorSpace.Linear)
|
||||
// {
|
||||
// Profiler.BeginSample("[UIParticle] Modify color space to linear");
|
||||
// particle.bakedMesh.ModifyColorSpaceToLinear();
|
||||
// Profiler.EndSample();
|
||||
// }
|
||||
|
||||
Profiler.BeginSample("[UIParticle] Set mesh to CanvasRenderer");
|
||||
particle.canvasRenderer.SetMesh(particle.bakedMesh);
|
||||
@@ -154,6 +159,9 @@ namespace Coffee.UIExtensions
|
||||
|
||||
particle.cachedPosition = position;
|
||||
|
||||
if (particle.activeMeshIndices.CountFast() == 0)
|
||||
diff = Vector3.zero;
|
||||
|
||||
for (var i = 0; i < particle.particles.Count; i++)
|
||||
{
|
||||
Profiler.BeginSample("[UIParticle] Bake Mesh > Push index");
|
||||
@@ -241,6 +249,10 @@ namespace Coffee.UIExtensions
|
||||
var hash = currentPs.GetMaterialHash(true);
|
||||
if (hash != 0)
|
||||
{
|
||||
matrix = currentPs.main.simulationSpace == ParticleSystemSimulationSpace.Local && currentPs.trails.worldSpace
|
||||
? matrix * Matrix4x4.Translate(-currentPs.transform.position)
|
||||
: matrix;
|
||||
|
||||
var m = MeshHelper.GetTemporaryMesh();
|
||||
try
|
||||
{
|
||||
|
||||
@@ -9,8 +9,9 @@ namespace Coffee.UIParticleExtensions
|
||||
internal static class SpriteExtensions
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
private static Type tSpriteEditorExtension = Type.GetType("UnityEditor.Experimental.U2D.SpriteEditorExtension, UnityEditor")
|
||||
?? Type.GetType("UnityEditor.U2D.SpriteEditorExtension, UnityEditor");
|
||||
private static Type tSpriteEditorExtension =
|
||||
Type.GetType("UnityEditor.Experimental.U2D.SpriteEditorExtension, UnityEditor")
|
||||
?? Type.GetType("UnityEditor.U2D.SpriteEditorExtension, UnityEditor");
|
||||
|
||||
private static MethodInfo miGetActiveAtlasTexture = tSpriteEditorExtension
|
||||
.GetMethod("GetActiveAtlasTexture", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
@@ -64,22 +65,32 @@ namespace Coffee.UIParticleExtensions
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool AnyFast<T>(this List<T> self, Predicate<T> predicate) where T : Object
|
||||
{
|
||||
for (var i = 0; i < self.Count; ++i)
|
||||
{
|
||||
if (self[i] && predicate(self[i])) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
self.GetColors(s_Colors);
|
||||
|
||||
for (var i = 0; i < s_Colors.Count; i++)
|
||||
s_Colors[i] = ((Color) s_Colors[i]).gamma;
|
||||
|
||||
self.SetColors(s_Colors);
|
||||
s_Colors.Clear();
|
||||
}
|
||||
// public static void ModifyColorSpaceToLinear(this Mesh self)
|
||||
// {
|
||||
// self.GetColors(s_Colors);
|
||||
//
|
||||
// for (var i = 0; i < s_Colors.Count; i++)
|
||||
// s_Colors[i] = ((Color) s_Colors[i]).gamma;
|
||||
//
|
||||
// self.SetColors(s_Colors);
|
||||
// s_Colors.Clear();
|
||||
// }
|
||||
|
||||
public static void Clear(this CombineInstance[] self)
|
||||
{
|
||||
@@ -93,7 +104,8 @@ namespace Coffee.UIParticleExtensions
|
||||
|
||||
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()
|
||||
{
|
||||
@@ -106,6 +118,7 @@ namespace Coffee.UIParticleExtensions
|
||||
var m = new Mesh();
|
||||
m.MarkDynamic();
|
||||
s_Pool.Push(m);
|
||||
s_HashPool.Add(m.GetInstanceID());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +128,11 @@ namespace Coffee.UIParticleExtensions
|
||||
while (0 < s_Pool.Count)
|
||||
{
|
||||
m = s_Pool.Pop();
|
||||
if (m) return m;
|
||||
if (m)
|
||||
{
|
||||
s_HashPool.Remove(m.GetInstanceID());
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
||||
m = new Mesh();
|
||||
@@ -125,9 +142,14 @@ namespace Coffee.UIParticleExtensions
|
||||
|
||||
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);
|
||||
s_Pool.Push(mesh);
|
||||
s_HashPool.Add(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +230,7 @@ namespace Coffee.UIParticleExtensions
|
||||
|
||||
// Sorting layer: ascending
|
||||
if (aRenderer.sortingLayerID != bRenderer.sortingLayerID)
|
||||
return aRenderer.sortingLayerID - bRenderer.sortingLayerID;
|
||||
return SortingLayer.GetLayerValueFromID(aRenderer.sortingLayerID) - SortingLayer.GetLayerValueFromID(bRenderer.sortingLayerID);
|
||||
|
||||
// Sorting order: ascending
|
||||
if (aRenderer.sortingOrder != bRenderer.sortingOrder)
|
||||
@@ -222,27 +244,18 @@ namespace Coffee.UIParticleExtensions
|
||||
if (!Mathf.Approximately(aPos, bPos))
|
||||
return (int) Mathf.Sign(bPos - aPos);
|
||||
|
||||
// Material instance ID: match
|
||||
if (aMat.GetInstanceID() == bMat.GetInstanceID())
|
||||
return 0;
|
||||
|
||||
// Transform: ascending
|
||||
return TransformCompare(aTransform, bTransform);
|
||||
return (int) Mathf.Sign(GetIndex(self, a) - GetIndex(self, b));
|
||||
});
|
||||
}
|
||||
|
||||
private static int TransformCompare(Transform a, Transform b)
|
||||
private static int GetIndex(IList<ParticleSystem> list, Object ps)
|
||||
{
|
||||
while (true)
|
||||
for (var i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (!a && !b) return 0;
|
||||
if (!a) return -1;
|
||||
if (!b) return 1;
|
||||
if (a.parent == b.parent) return a.GetSiblingIndex() - b.GetSiblingIndex();
|
||||
|
||||
a = a.parent;
|
||||
b = b.parent;
|
||||
if (list[i].GetInstanceID() == ps.GetInstanceID()) return i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static long GetMaterialHash(this ParticleSystem self, bool trail)
|
||||
|
||||
@@ -1,101 +1,117 @@
|
||||
Shader "UI/Additive"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
_ClipRect ("Clip Rect", Vector) = (-32767, -32767, 32767, 32767)
|
||||
}
|
||||
_StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
_StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
_ColorMask ("Color Mask", Float) = 15
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Fog { Mode Off }
|
||||
Blend One One
|
||||
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
||||
}
|
||||
|
||||
ColorMask [_ColorMask]
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
float4 worldPosition : TEXCOORD1;
|
||||
};
|
||||
|
||||
fixed4 _Color;
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
float4 _ClipRect;
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ZTest [unity_GUIZTestMode]
|
||||
Fog { Mode Off }
|
||||
Blend One One
|
||||
|
||||
v2f vert(appdata_t IN)
|
||||
{
|
||||
v2f OUT;
|
||||
OUT.worldPosition = IN.vertex;
|
||||
OUT.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
OUT.texcoord = TRANSFORM_TEX(IN.texcoord, _MainTex);
|
||||
#ifdef UNITY_HALF_TEXEL_OFFSET
|
||||
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
|
||||
#endif
|
||||
OUT.color = IN.color * _Color;
|
||||
return OUT;
|
||||
}
|
||||
ColorMask [_ColorMask]
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
|
||||
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
|
||||
color.rgb *= color.a;
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip (color.a - 0.01);
|
||||
#endif
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Pass
|
||||
{
|
||||
Name "Default"
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
|
||||
#pragma multi_compile __ UNITY_UI_CLIP_RECT
|
||||
#pragma multi_compile __ UNITY_UI_ALPHACLIP
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float4 worldPosition : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
fixed4 _Color;
|
||||
sampler2D _MainTex;
|
||||
float4 _MainTex_ST;
|
||||
fixed4 _TextureSampleAdd;
|
||||
float4 _ClipRect;
|
||||
|
||||
v2f vert(appdata_t v)
|
||||
{
|
||||
v2f OUT;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
||||
OUT.worldPosition = v.vertex;
|
||||
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
|
||||
|
||||
OUT.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
|
||||
|
||||
OUT.color = v.color * _Color;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f IN) : SV_Target
|
||||
{
|
||||
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
|
||||
|
||||
#ifdef UNITY_UI_CLIP_RECT
|
||||
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
|
||||
#endif
|
||||
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
clip (color.a - 0.001);
|
||||
#endif
|
||||
|
||||
color.rgb *= color.a;
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "com.coffee.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.",
|
||||
"version": "3.3.0",
|
||||
"version": "3.3.14",
|
||||
"unity": "2018.2",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user