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
58 Commits
develop-ne
...
5.0.0-prev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9523ae12c0 | ||
|
|
96106370e5 | ||
|
|
bb2d588e0c | ||
|
|
078005a1a7 | ||
|
|
0cff50ef69 | ||
|
|
0da652520c | ||
|
|
4199492e3a | ||
|
|
1f88bb255e | ||
|
|
73d208e9b8 | ||
|
|
bfac4d4e2f | ||
|
|
e3791866b7 | ||
|
|
6dfbdae38d | ||
|
|
b63220b871 | ||
|
|
3fd2bea599 | ||
|
|
925af0b604 | ||
|
|
d1a1e23e50 | ||
|
|
47ee45cbbe | ||
|
|
88d956ece8 | ||
|
|
1b0110320b | ||
|
|
2842b3db7d | ||
|
|
a1ca74f854 | ||
|
|
8276684c3b | ||
|
|
67de3d1bd3 | ||
|
|
c2958d5d7d | ||
|
|
7456b5d555 | ||
|
|
9955eefdc2 | ||
|
|
c09bfb81ab | ||
|
|
fab2ed1697 | ||
|
|
ef4dbc3cba | ||
|
|
27551a4d47 | ||
|
|
90d966e659 | ||
|
|
0036b03d12 | ||
|
|
934f4b8f1c | ||
|
|
fe4fcc5ddd | ||
|
|
072aac521b | ||
|
|
95235a929b | ||
|
|
1a748f19d0 | ||
|
|
f9ce2c6c96 | ||
|
|
abe09485f6 | ||
|
|
253fb52650 | ||
|
|
3544c593e2 | ||
|
|
4faf151c87 | ||
|
|
afe00a1dde | ||
|
|
c1e3d68f60 | ||
|
|
a1ea8785bc | ||
|
|
2ee69d0424 | ||
|
|
2c1ac4b5e9 | ||
|
|
5f255ec6cd | ||
|
|
1b678c68c6 | ||
|
|
5ff6ec815a | ||
|
|
0ee1671246 | ||
|
|
6a7f08c056 | ||
|
|
1ce4e31a96 | ||
|
|
c08f0d492f | ||
|
|
7069b396e4 | ||
|
|
109caed657 | ||
|
|
2a1cd502b4 | ||
|
|
78d0219235 |
6
.github/CODEOWNERS
vendored
Normal file
6
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# This is a comment.
|
||||||
|
# Each line is a file pattern followed by one or more owners.
|
||||||
|
# https://docs.github.com/ja/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
|
||||||
|
|
||||||
|
# Default owners
|
||||||
|
* @mob-sakai
|
||||||
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: mob-sakai # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
|
patreon: mob_sakai # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||||
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: mob-sakai
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one.
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Environment (please complete the following information):**
|
||||||
|
- Version [e.g. 1.0.0]
|
||||||
|
- Platform: [e.g. Editor(Windows/Mac), Standalone(Windows/Mac), iOS, Android, WebGL]
|
||||||
|
- Unity version: [e.g. 2018.2.8f1]
|
||||||
|
- Build options: [e.g. IL2CPP, .Net 4.x, LWRP]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
22
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: mob-sakai
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one.
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
16
.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
16
.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
name: Question
|
||||||
|
about: Ask a question about this project
|
||||||
|
title: ''
|
||||||
|
labels: question
|
||||||
|
assignees: mob-sakai
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
NOTE: Your issue may already be reported! Please search on the [issue tracker](../) before creating one.
|
||||||
|
|
||||||
|
**Describe what help do you need**
|
||||||
|
A description of the question.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the question here.
|
||||||
37
.github/pull_request_template.md
vendored
Normal file
37
.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
# Pull Request Template
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
- Please include a summary of the change and which issue is fixed.
|
||||||
|
- Please also include relevant motivation and context.
|
||||||
|
- List any dependencies that are required for this change.
|
||||||
|
|
||||||
|
Fixes #{issue_number}
|
||||||
|
|
||||||
|
## Type of change
|
||||||
|
|
||||||
|
Please write the commit message in the format corresponding to the change type.
|
||||||
|
Please see [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for more information.
|
||||||
|
|
||||||
|
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||||
|
- [ ] New feature (non-breaking change which adds functionality)
|
||||||
|
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||||
|
- [ ] Update documentations
|
||||||
|
- [ ] Others (refactoring, style changes, etc.)
|
||||||
|
|
||||||
|
## Test environment
|
||||||
|
|
||||||
|
- Platform: [e.g. Editor(Windows/Mac), Standalone(Windows/Mac), iOS, Android, WebGL]
|
||||||
|
- Unity version: [e.g. 2022.2.0f1]
|
||||||
|
- Build options: [e.g. IL2CPP, .Net 4.x, URP/HDRP]
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
|
||||||
|
- [ ] This pull request is for merging into the `develop` branch
|
||||||
|
- [ ] My code follows the style guidelines of this project
|
||||||
|
- [ ] I have performed a self-review of my own code
|
||||||
|
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||||
|
- [ ] I have made corresponding changes to the documentation
|
||||||
|
- [ ] My changes generate no new warnings
|
||||||
|
- [ ] I have checked my code and corrected any misspellings
|
||||||
28
.github/workflows/deploy.yml
vendored
Normal file
28
.github/workflows/deploy.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
name: 🚀 Deploy with Zip
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
zip:
|
||||||
|
description: "The url to the zip file"
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
name: 🚀 Deploy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
steps:
|
||||||
|
- name: 📦 Download zip file To '_site'
|
||||||
|
run: |
|
||||||
|
curl -L ${{ github.event.inputs.zip }} -o _site.zip
|
||||||
|
unzip _site.zip -d _site
|
||||||
|
find _site -name __MACOSX | xargs rm -rf
|
||||||
|
|
||||||
|
- name: 📦 Upload '_site'
|
||||||
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
|
||||||
|
- name: 🚀 Deploy To GitHub Pages
|
||||||
|
uses: actions/deploy-pages@v4
|
||||||
71
.github/workflows/release.yml
vendored
71
.github/workflows/release.yml
vendored
@@ -1,12 +1,13 @@
|
|||||||
name: 🔖 Release
|
name: 🔖 Release
|
||||||
|
run-name: 🔖 Release (${{ github.ref_name }})
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- release
|
- preview
|
||||||
- release-preview
|
- main
|
||||||
- release-v4
|
- v*.x
|
||||||
tags-ignore:
|
tags-ignore:
|
||||||
- "**"
|
- "**"
|
||||||
|
|
||||||
@@ -22,9 +23,6 @@ jobs:
|
|||||||
channel: ${{ steps.release.outputs.new_release_channel }}
|
channel: ${{ steps.release.outputs.new_release_channel }}
|
||||||
released: ${{ steps.release.outputs.new_release_published }}
|
released: ${{ steps.release.outputs.new_release_published }}
|
||||||
tag: ${{ steps.release.outputs.new_release_git_tag }}
|
tag: ${{ steps.release.outputs.new_release_git_tag }}
|
||||||
version: ${{ steps.release.outputs.new_release_version }}
|
|
||||||
merge_to: ${{ steps.summary.outputs.merge_to }}
|
|
||||||
split_to: ${{ steps.summary.outputs.split_to }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: 🚚 Checkout (${{ github.ref_name }})
|
- name: 🚚 Checkout (${{ github.ref_name }})
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -38,66 +36,9 @@ jobs:
|
|||||||
@semantic-release/changelog
|
@semantic-release/changelog
|
||||||
@semantic-release/git
|
@semantic-release/git
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
|
|
||||||
- id: summary
|
- run: |
|
||||||
run: |
|
|
||||||
echo "🔖 New release published: '${{ steps.release.outputs.new_release_published }}'" | tee -a $GITHUB_STEP_SUMMARY
|
echo "🔖 New release published: '${{ steps.release.outputs.new_release_published }}'" | tee -a $GITHUB_STEP_SUMMARY
|
||||||
echo "🔖 New release version: '${{ steps.release.outputs.new_release_version }}'" | tee -a $GITHUB_STEP_SUMMARY
|
|
||||||
echo "🔖 New release channel: '${{ steps.release.outputs.new_release_channel }}'" | tee -a $GITHUB_STEP_SUMMARY
|
echo "🔖 New release channel: '${{ steps.release.outputs.new_release_channel }}'" | tee -a $GITHUB_STEP_SUMMARY
|
||||||
echo "🔖 New release git tag: '${{ steps.release.outputs.new_release_git_tag }}'" | tee -a $GITHUB_STEP_SUMMARY
|
echo "🔖 New release git tag: '${{ steps.release.outputs.new_release_git_tag }}'" | tee -a $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
if [ '${{ steps.release.outputs.new_release_published }}' = 'false' ]; then
|
|
||||||
echo "No new release published." | tee -a $GITHUB_STEP_SUMMARY
|
|
||||||
elif [ '${{ github.ref_name }}' = 'release' ]; then
|
|
||||||
echo "merge_to=develop" | tee -a $GITHUB_OUTPUT
|
|
||||||
echo "split_to=main" | tee -a $GITHUB_OUTPUT
|
|
||||||
elif [ '${{ github.ref_name }}' = 'release-preview' ]; then
|
|
||||||
echo "merge_to=develop-preview" | tee -a $GITHUB_OUTPUT
|
|
||||||
echo "split_to=preview" | tee -a $GITHUB_OUTPUT
|
|
||||||
elif [ '${{ github.ref_name }}' = 'release-4.x' ]; then
|
|
||||||
echo "merge_to=develop-4.x" | tee -a $GITHUB_OUTPUT
|
|
||||||
echo "split_to=4.x" | tee -a $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
merge-to:
|
|
||||||
if: needs.release.outputs.merge_to != ''
|
|
||||||
needs: release
|
|
||||||
name: 🔀 Merge to ${{ needs.release.outputs.merge_to }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
steps:
|
|
||||||
- name: 🚚 Checkout (${{ needs.release.outputs.merge_to }})
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ needs.release.outputs.merge_to }}
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: 🔀 Merge '${{ needs.release.outputs.tag }}' into '${{ needs.release.outputs.merge_to }}'
|
|
||||||
run: |
|
|
||||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
git config --local user.name "github-actions[bot]"
|
|
||||||
|
|
||||||
git merge ${{ needs.release.outputs.tag }}
|
|
||||||
git push origin ${{ needs.release.outputs.merge_to }}
|
|
||||||
|
|
||||||
split-to:
|
|
||||||
if: needs.release.outputs.split_to != ''
|
|
||||||
needs: release
|
|
||||||
name: 🔀 Split package to ${{ needs.release.outputs.split_to }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
steps:
|
|
||||||
- name: 🚚 Checkout (${{ needs.release.outputs.tag }})
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ needs.release.outputs.tag }}
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: 🔀 Split subtree 'Packages/src' to '${{ needs.release.outputs.split_to }}'
|
|
||||||
run: |
|
|
||||||
split_to=${{ needs.release.outputs.split_to }}
|
|
||||||
git branch $split_to origin/$split_to
|
|
||||||
git subtree split --prefix=Packages/src --branch $split_to
|
|
||||||
git tag ${{ needs.release.outputs.version }} $split_to
|
|
||||||
git push origin ${{ needs.release.outputs.version }} $split_to:$split_to
|
|
||||||
|
|||||||
61
.github/workflows/test.yml
vendored
61
.github/workflows/test.yml
vendored
@@ -3,28 +3,36 @@
|
|||||||
# UNITY_EMAIL: Unity user email to login
|
# UNITY_EMAIL: Unity user email to login
|
||||||
# UNITY_PASSWORD: Unity user password to login
|
# UNITY_PASSWORD: Unity user password to login
|
||||||
name: 🧪 Test
|
name: 🧪 Test
|
||||||
|
run-name: 🧪 Test (${{ github.event.pull_request.title || github.ref_name }})
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# MINIMUM_VERSION: The minimum version of Unity.
|
# MINIMUM_VERSION: The minimum version of Unity.
|
||||||
MINIMUM_VERSION: 2019.4
|
MINIMUM_VERSION: 2019.4
|
||||||
# EXCLUDE_FILTER: The excluded versions of Unity.
|
# EXCLUDE_FILTER: The excluded versions of Unity.
|
||||||
EXCLUDE_FILTER: '(2020.2.0)'
|
EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.3)"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
usePeriodVersions:
|
||||||
|
description: "Use the period versions (.0f1, .10f1, 20f1, ...)."
|
||||||
|
required: false
|
||||||
|
default: "true"
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- develop
|
- develop
|
||||||
- develop-preview
|
- develop-preview
|
||||||
- develop-4.x
|
|
||||||
tags:
|
tags:
|
||||||
- "!*"
|
- "!*"
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "*.md"
|
- "**.md"
|
||||||
pull_request:
|
pull_request_target:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
|
- reopened
|
||||||
- synchronize
|
- synchronize
|
||||||
|
paths-ignore:
|
||||||
|
- "**.md"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
setup:
|
setup:
|
||||||
@@ -37,9 +45,12 @@ jobs:
|
|||||||
id: setup
|
id: setup
|
||||||
run: |
|
run: |
|
||||||
echo "==== Target Unity Versions ===="
|
echo "==== Target Unity Versions ===="
|
||||||
LATEST_VERSIONS=`npx unity-changeset list --versions --latest-patch --min ${MINIMUM_VERSION} --json --all`
|
LATEST_VERSIONS=`npx unity-changeset@latest list --versions --latest-patch --min ${MINIMUM_VERSION} --json --all`
|
||||||
# ADDITIONAL_VERSIONS=`npx unity-changeset list --versions --grep '0f' --min ${MINIMUM_VERSION} --json`
|
if [ "${{ inputs.usePeriodVersions }}" = "true" ]; then
|
||||||
ADDITIONAL_VERSIONS=[]
|
ADDITIONAL_VERSIONS=`npx unity-changeset list --versions --grep '0f' --min ${MINIMUM_VERSION} --json`
|
||||||
|
else
|
||||||
|
ADDITIONAL_VERSIONS=[]
|
||||||
|
fi
|
||||||
|
|
||||||
VERSIONS=`echo "[${LATEST_VERSIONS}, ${ADDITIONAL_VERSIONS}]" \
|
VERSIONS=`echo "[${LATEST_VERSIONS}, ${ADDITIONAL_VERSIONS}]" \
|
||||||
| jq -c '[ flatten | sort | unique | .[] | select( test("${{ env.EXCLUDE_FILTER }}") | not ) ]'`
|
| jq -c '[ flatten | sort | unique | .[] | select( test("${{ env.EXCLUDE_FILTER }}") | not ) ]'`
|
||||||
@@ -48,33 +59,44 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
name: 🧪 Run tests
|
name: 🧪 Run tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
||||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
||||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
||||||
permissions:
|
permissions:
|
||||||
checks: write
|
checks: write
|
||||||
contents: read
|
contents: read
|
||||||
needs: setup
|
needs: setup
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
max-parallel: 4
|
max-parallel: 6
|
||||||
matrix:
|
matrix:
|
||||||
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
|
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
|
||||||
steps:
|
steps:
|
||||||
- name: 🚚 Checkout
|
- name: 🚚 Checkout ($${{ github.ref }})
|
||||||
|
if: github.event_name == 'push'
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 🚚 Checkout pull request (pull_request_target)
|
||||||
|
if: github.event_name == 'pull_request_target'
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: 🚚 Marge pull request (pull_request_target)
|
||||||
|
if: github.event_name == 'pull_request_target'
|
||||||
|
run: |
|
||||||
|
git config user.name "GitHub Actions"
|
||||||
|
git config user.email "actions@github.com"
|
||||||
|
git merge origin/${{ github.event.pull_request.base.ref }} --no-edit
|
||||||
|
|
||||||
- name: 📥 Cache library
|
- name: 📥 Cache library
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: Library
|
path: Library
|
||||||
key: Library-${{ matrix.unityVersion }}-${{ github.sha }}
|
key: Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
Library-${{ matrix.unityVersion }}-
|
Library-${{ matrix.unityVersion }}-
|
||||||
Library-
|
Library-
|
||||||
|
|
||||||
- name: 🛠️ Build Unity Project
|
- name: 🛠️ Build Unity Project (Test)
|
||||||
uses: game-ci/unity-builder@v4
|
uses: game-ci/unity-builder@v4
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
with:
|
with:
|
||||||
@@ -82,6 +104,10 @@ jobs:
|
|||||||
targetPlatform: StandaloneLinux64
|
targetPlatform: StandaloneLinux64
|
||||||
allowDirtyBuild: true
|
allowDirtyBuild: true
|
||||||
customParameters: -nographics
|
customParameters: -nographics
|
||||||
|
env:
|
||||||
|
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||||
|
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||||
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||||
|
|
||||||
- name: 🧪 Run tests
|
- name: 🧪 Run tests
|
||||||
uses: game-ci/unity-test-runner@v4
|
uses: game-ci/unity-test-runner@v4
|
||||||
@@ -92,4 +118,7 @@ jobs:
|
|||||||
customParameters: -nographics
|
customParameters: -nographics
|
||||||
checkName: ${{ matrix.unityVersion }} Test Results
|
checkName: ${{ matrix.unityVersion }} Test Results
|
||||||
githubToken: ${{ github.token }}
|
githubToken: ${{ github.token }}
|
||||||
coverageOptions: "dontClear;generateHtmlReport;generateBadgeReport;pathFilters:+**/Packages/src/**;assemblyFilters:+<packages>,-*.Editor,-*.Test"
|
env:
|
||||||
|
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||||
|
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||||
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||||
|
|||||||
7046
Assets/Demo/Cartoon FX & War FX Demo/CFXRF Demo.unity
Normal file
7046
Assets/Demo/Cartoon FX & War FX Demo/CFXRF Demo.unity
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e34a092899a9547189add96707de1b5a
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
@@ -80,7 +80,11 @@ namespace Coffee.UIExtensions.Demo
|
|||||||
.SelectMany(x => x.GetTypes())
|
.SelectMany(x => x.GetTypes())
|
||||||
.FirstOrDefault(x => x.Name == typeName);
|
.FirstOrDefault(x => x.Name == typeName);
|
||||||
|
|
||||||
|
#if UNITY_2023_2_OR_NEWER
|
||||||
|
return type == null ? null : FindFirstObjectByType(type);
|
||||||
|
#else
|
||||||
return type == null ? null : FindObjectOfType(type);
|
return type == null ? null : FindObjectOfType(type);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetCanvasWidth(int width)
|
public void SetCanvasWidth(int width)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Coffee.UIParticleInternal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Serialization;
|
using UnityEngine.Serialization;
|
||||||
|
|
||||||
@@ -46,11 +47,7 @@ namespace Coffee.UIExtensions.Demo
|
|||||||
|
|
||||||
if (!flag)
|
if (!flag)
|
||||||
{
|
{
|
||||||
#if UNITY_2023_1_OR_NEWER
|
foreach (var ps in Misc.FindObjectsOfType<ParticleSystem>())
|
||||||
foreach (var ps in FindObjectsByType<ParticleSystem>(FindObjectsInactive.Include, FindObjectsSortMode.None))
|
|
||||||
#else
|
|
||||||
foreach (var ps in FindObjectsOfType<ParticleSystem>())
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
ps.Play(false);
|
ps.Play(false);
|
||||||
}
|
}
|
||||||
@@ -79,11 +76,7 @@ namespace Coffee.UIExtensions.Demo
|
|||||||
|
|
||||||
public void ParticleSystem_SetScale(float scale)
|
public void ParticleSystem_SetScale(float scale)
|
||||||
{
|
{
|
||||||
#if UNITY_2023_1_OR_NEWER
|
foreach (var ps in Misc.FindObjectsOfType<ParticleSystem>())
|
||||||
foreach (var ps in FindObjectsByType<ParticleSystem>(FindObjectsInactive.Include, FindObjectsSortMode.None))
|
|
||||||
#else
|
|
||||||
foreach (var ps in FindObjectsOfType<ParticleSystem>())
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
ps.transform.localScale = new Vector3(scale, scale, scale);
|
ps.transform.localScale = new Vector3(scale, scale, scale);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,12 @@ MonoBehaviour:
|
|||||||
m_EnabledInEditor: 1
|
m_EnabledInEditor: 1
|
||||||
m_AlwaysIncludeAssembly: 1
|
m_AlwaysIncludeAssembly: 1
|
||||||
m_InstantiateOnLoad: 1
|
m_InstantiateOnLoad: 1
|
||||||
m_Prefab: {fileID: 7211429669315726685, guid: b73940fc30a2f4eb9a73783e9c1f8da6,
|
m_Prefab: {fileID: 4567906826058368312, guid: 7cebff2d255b9433cbe23b243c193329,
|
||||||
type: 3}
|
type: 3}
|
||||||
m_Interval: 0.5
|
m_Interval: 0.5
|
||||||
m_Anchor: 0
|
m_Anchor: 0
|
||||||
m_Width: 750
|
m_Width: 750
|
||||||
|
m_HelpUrl: https://github.com/mob-sakai/ParticleEffectForUGUI
|
||||||
m_CustomMonitorItems:
|
m_CustomMonitorItems:
|
||||||
- m_Format: Screen:{0}x{1}
|
- m_Format: Screen:{0}x{1}
|
||||||
m_Arg0:
|
m_Arg0:
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: b73940fc30a2f4eb9a73783e9c1f8da6
|
|
||||||
PrefabImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -10,6 +10,7 @@ MonoBehaviour:
|
|||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: f22a23b9d98e440478697f4adf30e61c, type: 3}
|
m_Script: {fileID: 11500000, guid: f22a23b9d98e440478697f4adf30e61c, type: 3}
|
||||||
m_Name: UIParticle
|
m_Name: UIParticleProjectSettings
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_LinearToGamma: 1
|
m_EnableLinearToGamma: 1
|
||||||
|
m_HideGeneratedObjects: 1
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: e8e7744b163af4869b07b8f192c810ed
|
guid: a5b9278dfbd194d04b1c6ae7031928c1
|
||||||
NativeFormatImporter:
|
NativeFormatImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
mainObjectFileID: 11400000
|
mainObjectFileID: 11400000
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.ide.rider": "3.0.31",
|
|
||||||
"com.coffee.development": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/Development",
|
"com.coffee.development": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/Development",
|
||||||
|
"com.coffee.minimal-resource": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/MinimalResource",
|
||||||
"com.coffee.nano-monitor": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
|
"com.coffee.nano-monitor": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
|
||||||
"com.coffee.sub-asset-editor": "https://github.com/mob-sakai/SubAssetEditor.git",
|
"com.unity.ide.rider": "3.0.31",
|
||||||
"com.unity.test-framework": "1.1.33",
|
"com.unity.test-framework": "1.1.33",
|
||||||
"com.unity.modules.animation": "1.0.0",
|
"com.unity.modules.animation": "1.0.0",
|
||||||
"com.unity.modules.physics": "1.0.0"
|
"com.unity.modules.physics": "1.0.0"
|
||||||
|
|||||||
@@ -5,7 +5,14 @@
|
|||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "git",
|
"source": "git",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"hash": "c51e4514c9ab944915a639433ee52342e55a644e"
|
"hash": "3c280f1a8f4db5038b881ff07f270efd9638fa31"
|
||||||
|
},
|
||||||
|
"com.coffee.minimal-resource": {
|
||||||
|
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/MinimalResource",
|
||||||
|
"depth": 0,
|
||||||
|
"source": "git",
|
||||||
|
"dependencies": {},
|
||||||
|
"hash": "3c280f1a8f4db5038b881ff07f270efd9638fa31"
|
||||||
},
|
},
|
||||||
"com.coffee.nano-monitor": {
|
"com.coffee.nano-monitor": {
|
||||||
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
|
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
|
||||||
@@ -14,14 +21,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.ugui": "1.0.0"
|
"com.unity.ugui": "1.0.0"
|
||||||
},
|
},
|
||||||
"hash": "c51e4514c9ab944915a639433ee52342e55a644e"
|
"hash": "3c280f1a8f4db5038b881ff07f270efd9638fa31"
|
||||||
},
|
|
||||||
"com.coffee.sub-asset-editor": {
|
|
||||||
"version": "https://github.com/mob-sakai/SubAssetEditor.git",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "git",
|
|
||||||
"dependencies": {},
|
|
||||||
"hash": "01464178eec1e4dbe741c11c9baeb94a151c99ee"
|
|
||||||
},
|
},
|
||||||
"com.coffee.ui-particle": {
|
"com.coffee.ui-particle": {
|
||||||
"version": "file:src",
|
"version": "file:src",
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
{
|
{
|
||||||
"branches": [
|
"branches": [
|
||||||
"release",
|
"main",
|
||||||
"release-4.x",
|
"[0-9]+.x",
|
||||||
{
|
{
|
||||||
"name": "release-preview",
|
"name": "preview",
|
||||||
"prerelease": "preview"
|
"prerelease": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"tagFormat": "${version}",
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@semantic-release/commit-analyzer",
|
"@semantic-release/commit-analyzer",
|
||||||
"@semantic-release/release-notes-generator",
|
"@semantic-release/release-notes-generator",
|
||||||
|
|||||||
@@ -1,3 +1,99 @@
|
|||||||
|
# [5.0.0-preview.16](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/5.0.0-preview.15...5.0.0-preview.16) (2025-03-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* IL2CPP build fails on older versions of Unity ([0da6525](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/0da652520cd165b43de7404c0b0ab1fbcf9349d1))
|
||||||
|
* NRE on enable ([0cff50e](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/0cff50ef696aa53fb7c46a9a737b7cf3a05b7b9b)), closes [#359](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/359)
|
||||||
|
|
||||||
|
# [5.0.0-preview.15](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/5.0.0-preview.14...5.0.0-preview.15) (2025-02-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* component icons will no longer be displayed in the scene view ([6dfbdae](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/6dfbdae38d3822ab9c2c6f0e4ca1ca32ee98a239))
|
||||||
|
* editor crashed on exit play mode (editor, windows) ([47ee45c](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/47ee45cbbe651a8f87ca2b8a3948f8b88db8211e)), closes [#351](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/351)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add 'TimeScaleMultiplier' option ([925af0b](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/925af0b6046f65f23a778f67cefa8ff9cbedb513))
|
||||||
|
|
||||||
|
# [5.0.0-preview.14](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/5.0.0-preview.13...5.0.0-preview.14) (2025-01-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* sub-emitter particles may not render correctly in certain scenarios ([8276684](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/8276684c3b1646f0490ed64557547ba15281664a)), closes [#348](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/348)
|
||||||
|
* sub-emitter's `inherit velocity` module doubles at runtime ([67de3d1](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/67de3d1bd3e16dc9b564625cb990c53d75769506)), closes [#349](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/349)
|
||||||
|
|
||||||
|
# [5.0.0-preview.13](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/5.0.0-preview.12...5.0.0-preview.13) (2025-01-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* change the default value of `UIParticle.scale` from `10` to `1` ([9955eef](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/9955eefdc22cf565502f85c87cd2efd3a25fbe50))
|
||||||
|
* UIParticle no longer inherits from MaskableGraphic ([c09bfb8](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/c09bfb81abc9179bf5fc49d29eaf7fc4ed01a4dc))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* Some members inherited from MaskableGraphic will no longer be available.
|
||||||
|
|
||||||
|
## [4.10.5](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.10.4...v4.10.5) (2024-12-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* '3D' scale toggle in the inspector does not keep on reload ([934f4b8](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/934f4b8f1c61f8ff20228d0ebcea9f636a3758ed)), closes [#346](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/346)
|
||||||
|
|
||||||
|
## [4.10.4](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.10.3...v4.10.4) (2024-12-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* rendering issues when playing with opening a prefab stage ([95235a9](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/95235a929b82cf681365ed6eba837d857f83e3d2)), closes [#345](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/345)
|
||||||
|
|
||||||
|
## [4.10.3](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.10.2...v4.10.3) (2024-11-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* if not configured as a preloaded asset, the project settings asset will be regenerated ([abe0948](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/abe09485f65dd4efd18e74675e752e0213bdf3be)), closes [#342](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/342)
|
||||||
|
|
||||||
|
## [4.10.2](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.10.1...v4.10.2) (2024-11-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* trail incorrect offset ([afe00a1](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/afe00a1dde80eb1c0a7bb668b75f4c3733d3fa43)), closes [#335](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/335)
|
||||||
|
|
||||||
|
## [4.10.1](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.10.0...v4.10.1) (2024-09-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* mainTex will be ignored ([2ee69d0](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/2ee69d04245fabce185f67dc9bd68c870e556564))
|
||||||
|
|
||||||
|
# [4.10.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.9.1...v4.10.0) (2024-09-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* component icon is not set ([5ff6ec8](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/5ff6ec815a174de5d3f16d424f1204c60912a8d8))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add project settings ([1ce4e31](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/1ce4e31a9681bf1a201d2723c8d97e07ecc16592))
|
||||||
|
|
||||||
|
## [4.9.1](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.9.0...v4.9.1) (2024-08-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* ParticleSystem trails gain offset on parent canvas change ([2a1cd50](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/2a1cd502b452b5b56edf8bcfe91adf99d1bb5147)), closes [#323](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/323)
|
||||||
|
|
||||||
# [4.9.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.8.1...v4.9.0) (2024-07-18)
|
# [4.9.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.8.1...v4.9.0) (2024-07-18)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,16 +6,14 @@ using UnityEditorInternal;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Profiling;
|
using UnityEngine.Profiling;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using Coffee.UIParticleInternal;
|
||||||
#if UNITY_2021_2_OR_NEWER
|
#if UNITY_2021_2_OR_NEWER
|
||||||
using UnityEditor.Overlays;
|
using UnityEditor.Overlays;
|
||||||
#else
|
#else
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Coffee.UIParticleInternal;
|
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UNITY_2021_2_OR_NEWER
|
#if UNITY_2021_2_OR_NEWER
|
||||||
using UnityEditor.SceneManagement;
|
using UnityEditor.SceneManagement;
|
||||||
|
|
||||||
@@ -29,6 +27,11 @@ namespace Coffee.UIExtensions
|
|||||||
[CanEditMultipleObjects]
|
[CanEditMultipleObjects]
|
||||||
internal class UIParticleEditor : Editor
|
internal class UIParticleEditor : Editor
|
||||||
{
|
{
|
||||||
|
internal class State : ScriptableSingleton<State>
|
||||||
|
{
|
||||||
|
public bool is3DScaleMode;
|
||||||
|
}
|
||||||
|
|
||||||
//################################
|
//################################
|
||||||
// Constant or Static Members.
|
// Constant or Static Members.
|
||||||
//################################
|
//################################
|
||||||
@@ -47,7 +50,6 @@ namespace Coffee.UIExtensions
|
|||||||
private static readonly GUIContent s_ContentPrimary = new GUIContent("Primary");
|
private static readonly GUIContent s_ContentPrimary = new GUIContent("Primary");
|
||||||
private static readonly Regex s_RegexBuiltInGuid = new Regex(@"^0{16}.0{15}$", RegexOptions.Compiled);
|
private static readonly Regex s_RegexBuiltInGuid = new Regex(@"^0{16}.0{15}$", RegexOptions.Compiled);
|
||||||
private static readonly List<Material> s_TempMaterials = new List<Material>();
|
private static readonly List<Material> s_TempMaterials = new List<Material>();
|
||||||
private static bool s_XYZMode;
|
|
||||||
|
|
||||||
private SerializedProperty _maskable;
|
private SerializedProperty _maskable;
|
||||||
private SerializedProperty _scale3D;
|
private SerializedProperty _scale3D;
|
||||||
@@ -59,8 +61,10 @@ namespace Coffee.UIExtensions
|
|||||||
private SerializedProperty _autoScalingMode;
|
private SerializedProperty _autoScalingMode;
|
||||||
private SerializedProperty _useCustomView;
|
private SerializedProperty _useCustomView;
|
||||||
private SerializedProperty _customViewSize;
|
private SerializedProperty _customViewSize;
|
||||||
|
private SerializedProperty _timeScaleMultiplier;
|
||||||
private ReorderableList _ro;
|
private ReorderableList _ro;
|
||||||
private bool _showMax;
|
private bool _showMax;
|
||||||
|
private bool _is3DScaleMode;
|
||||||
|
|
||||||
private static readonly HashSet<Shader> s_Shaders = new HashSet<Shader>();
|
private static readonly HashSet<Shader> s_Shaders = new HashSet<Shader>();
|
||||||
#if UNITY_2018 || UNITY_2019
|
#if UNITY_2018 || UNITY_2019
|
||||||
@@ -94,6 +98,7 @@ namespace Coffee.UIExtensions
|
|||||||
_autoScalingMode = serializedObject.FindProperty("m_AutoScalingMode");
|
_autoScalingMode = serializedObject.FindProperty("m_AutoScalingMode");
|
||||||
_useCustomView = serializedObject.FindProperty("m_UseCustomView");
|
_useCustomView = serializedObject.FindProperty("m_UseCustomView");
|
||||||
_customViewSize = serializedObject.FindProperty("m_CustomViewSize");
|
_customViewSize = serializedObject.FindProperty("m_CustomViewSize");
|
||||||
|
_timeScaleMultiplier = serializedObject.FindProperty("m_TimeScaleMultiplier");
|
||||||
|
|
||||||
var sp = serializedObject.FindProperty("m_Particles");
|
var sp = serializedObject.FindProperty("m_Particles");
|
||||||
_ro = new ReorderableList(sp.serializedObject, sp, true, true, true, true)
|
_ro = new ReorderableList(sp.serializedObject, sp, true, true, true, true)
|
||||||
@@ -162,6 +167,19 @@ namespace Coffee.UIExtensions
|
|||||||
uip.RefreshParticles(uip.particles);
|
uip.RefreshParticles(uip.particles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize 3D scale mode.
|
||||||
|
_is3DScaleMode = State.instance.is3DScaleMode;
|
||||||
|
if (!_is3DScaleMode)
|
||||||
|
{
|
||||||
|
var x = _scale3D.FindPropertyRelative("x");
|
||||||
|
var y = _scale3D.FindPropertyRelative("y");
|
||||||
|
var z = _scale3D.FindPropertyRelative("z");
|
||||||
|
_is3DScaleMode = !Mathf.Approximately(x.floatValue, y.floatValue) ||
|
||||||
|
!Mathf.Approximately(y.floatValue, z.floatValue) ||
|
||||||
|
y.hasMultipleDifferentValues ||
|
||||||
|
z.hasMultipleDifferentValues;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -180,7 +198,11 @@ namespace Coffee.UIExtensions
|
|||||||
|
|
||||||
// Scale
|
// Scale
|
||||||
EditorGUI.BeginDisabledGroup(!_meshSharing.hasMultipleDifferentValues && _meshSharing.intValue == 4);
|
EditorGUI.BeginDisabledGroup(!_meshSharing.hasMultipleDifferentValues && _meshSharing.intValue == 4);
|
||||||
s_XYZMode = DrawFloatOrVector3Field(_scale3D, s_XYZMode);
|
if (DrawFloatOrVector3Field(_scale3D, _is3DScaleMode) != _is3DScaleMode)
|
||||||
|
{
|
||||||
|
State.instance.is3DScaleMode = _is3DScaleMode = !_is3DScaleMode;
|
||||||
|
}
|
||||||
|
|
||||||
EditorGUI.EndDisabledGroup();
|
EditorGUI.EndDisabledGroup();
|
||||||
|
|
||||||
// AnimatableProperties
|
// AnimatableProperties
|
||||||
@@ -221,6 +243,9 @@ namespace Coffee.UIExtensions
|
|||||||
_customViewSize.floatValue = Mathf.Max(0.1f, _customViewSize.floatValue);
|
_customViewSize.floatValue = Mathf.Max(0.1f, _customViewSize.floatValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Time Scale Multiplier
|
||||||
|
EditorGUILayout.PropertyField(_timeScaleMultiplier);
|
||||||
|
|
||||||
// Target ParticleSystems.
|
// Target ParticleSystems.
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
_ro.DoLayoutList();
|
_ro.DoLayoutList();
|
||||||
@@ -436,7 +461,11 @@ namespace Coffee.UIExtensions
|
|||||||
{
|
{
|
||||||
if (!p || (ignoreCurrent && target == p)) return;
|
if (!p || (ignoreCurrent && target == p)) return;
|
||||||
|
|
||||||
DestroyImmediate(p);
|
Misc.DestroyImmediate(p);
|
||||||
|
if (p.TryGetComponent<CanvasRenderer>(out var cr))
|
||||||
|
{
|
||||||
|
Misc.DestroyImmediate(cr);
|
||||||
|
}
|
||||||
|
|
||||||
#if UNITY_2018_3_OR_NEWER
|
#if UNITY_2018_3_OR_NEWER
|
||||||
var stage = PrefabStageUtility.GetCurrentPrefabStage();
|
var stage = PrefabStageUtility.GetCurrentPrefabStage();
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 418 B |
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 7a55e246f37df405bac88eac692e3a86
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
# <img alt="UIParticleIcon" src="https://github.com/mob-sakai/ParticleEffectForUGUI/assets/12690315/d76e105e-a840-4f61-a1f6-8cf311c0812d" width="26"/> Particle Effect For UGUI (UI Particle) <!-- omit in toc -->
|
# <img alt="UIParticleIcon" src="https://github.com/mob-sakai/ParticleEffectForUGUI/assets/12690315/d76e105e-a840-4f61-a1f6-8cf311c0812d" width="26"/> UI Particle v5 <!-- omit in toc -->
|
||||||
|
|
||||||
[](https://openupm.com/packages/com.coffee.ui-particle/)
|
[](https://openupm.com/packages/com.coffee.ui-particle/)
|
||||||
[](https://github.com/mob-sakai/ParticleEffectForUGUI/releases)
|
[](https://github.com/mob-sakai/ParticleEffectForUGUI/releases)
|
||||||
[](https://github.com/mob-sakai/ParticleEffectForUGUI/blob/main/LICENSE.md)
|
[](https://github.com/mob-sakai/ParticleEffectForUGUI/blob/main/LICENSE.md)
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
@@ -26,8 +26,8 @@ You can render, mask, and sort your `ParticleSystems` for UI without the need fo
|
|||||||
- [Install via OpenUPM](#install-via-openupm)
|
- [Install via OpenUPM](#install-via-openupm)
|
||||||
- [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)
|
- [🔄 Upgrading from v3/v4 to v5](#-upgrading-from-v3v4-to-v5)
|
||||||
- [Breaking Changes](#breaking-changes)
|
- [Breaking Changes](#breaking-changes)
|
||||||
- [🚀 Usage](#-usage)
|
- [🚀 Usage](#-usage)
|
||||||
- [Component: UIParticle](#component-uiparticle)
|
- [Component: UIParticle](#component-uiparticle)
|
||||||
@@ -36,6 +36,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 `Mask` or `RectMask2D` Component](#usage-with-mask-or-rectmask2d-component)
|
||||||
- [Usage with Script](#usage-with-script)
|
- [Usage with Script](#usage-with-script)
|
||||||
- [Component: UIParticleAttractor](#component-uiparticleattractor)
|
- [Component: UIParticleAttractor](#component-uiparticleattractor)
|
||||||
|
- [Project Settings](#project-settings)
|
||||||
- [🛠 Development Note](#-development-note)
|
- [🛠 Development Note](#-development-note)
|
||||||
- [Compares the Baking mesh approach with the conventional approach](#compares-the-baking-mesh-approach-with-the-conventional-approach)
|
- [Compares the Baking mesh approach with the conventional approach](#compares-the-baking-mesh-approach-with-the-conventional-approach)
|
||||||
- [Performance test results](#performance-test-results)
|
- [Performance test results](#performance-test-results)
|
||||||
@@ -105,7 +106,7 @@ You can render, mask, and sort your `ParticleSystems` for UI without the need fo
|
|||||||
|
|
||||||
## ⚙ Installation
|
## ⚙ Installation
|
||||||
|
|
||||||
_This package requires **Unity 2018.3 or later**._
|
_This package requires **Unity 2019.3 or later**._
|
||||||
|
|
||||||
#### Install via OpenUPM
|
#### Install via OpenUPM
|
||||||
|
|
||||||
@@ -117,16 +118,16 @@ _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}`:
|
- 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@5.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Install via UPM (with Package Manager UI)
|
#### Install via UPM (with Package Manager UI)
|
||||||
|
|
||||||
- Click `Window > Package Manager` to open Package Manager UI.
|
- Click `Window > Package Manager` to open Package Manager UI.
|
||||||
- Click `+ > Add package from git URL...` and input the repository URL: `https://github.com/mob-sakai/ParticleEffectForUGUI.git`
|
- Click `+ > Add package from git URL...` and input the repository URL: `https://github.com/mob-sakai/ParticleEffectForUGUI.git?path=Packages/src`
|
||||||

|

|
||||||
- To update the package, change suffix `#{version}` to the target version.
|
- 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?path=Packages/src#5.0.0`
|
||||||
|
|
||||||
#### Install via UPM (Manually)
|
#### Install via UPM (Manually)
|
||||||
|
|
||||||
@@ -134,33 +135,41 @@ _This package requires **Unity 2018.3 or later**._
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.coffee.ui-particle": "https://github.com/mob-sakai/ParticleEffectForUGUI.git",
|
"com.coffee.ui-particle": "https://github.com/mob-sakai/ParticleEffectForUGUI.git?path=Packages/src",
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- To update the package, change suffix `#{version}` to the target version.
|
- 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?path=Packages/src#5.0.0",`
|
||||||
|
|
||||||
#### Install as Embedded Package
|
### Install as Embedded Package
|
||||||
|
|
||||||
1. Download a source code zip file from [Releases](https://github.com/mob-sakai/ParticleEffectForUGUI.git/releases) and extract it.
|
1. Download the `Source code (zip)` file from [Releases](https://github.com/mob-sakai/SoftMaskForUGUI/releases) and
|
||||||
2. Place it in your project's `Packages` directory.
|
extract it.
|
||||||

|
2. Move the `<extracted_dir>/Packages/src` directory into your project's `Packages` directory.
|
||||||
- If you want to fix bugs or add features, install it as an embedded package.
|

|
||||||
- To update the package, you need to re-download it and replace the contents.
|
- You can rename the `src` directory if needed.
|
||||||
|
- If you intend to fix bugs or add features, installing it as an embedded package is recommended.
|
||||||
|
- To update the package, re-download it and replace the existing contents.
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
## 🔄 Upgrading from 3.x/4.x to 5.x
|
## 🔄 Upgrading from v3/v4 to v5
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
||||||
- The default value of `UIParticle.scale` has been changed from `10` to `1`.
|
- The default value of `UIParticle.scale` has been changed from `10` to `1`.
|
||||||
- `UIParticle` no longer inherits from `MaskableGraphic`.
|
- `UIParticle` no longer inherits from `MaskableGraphic`.
|
||||||
- Add project settings for UIParticle
|
- If you are installing via git URL, add `?path=Packages/src`.
|
||||||
- enableLinearToGamma: Enables LinearToGamma during mesh baking
|
```json
|
||||||
|
// v3/v4
|
||||||
|
"com.coffee.ui-particle": "https://github.com/mob-sakai/ParticleEffectForUGUI.git",
|
||||||
|
|
||||||
|
// v5
|
||||||
|
"com.coffee.ui-particle": "https://github.com/mob-sakai/ParticleEffectForUGUI.git?path=Packages/src",
|
||||||
|
```
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
@@ -170,7 +179,7 @@ _This package requires **Unity 2018.3 or later**._
|
|||||||
|
|
||||||
`UIParticle` controls the ParticleSystems that are attached to its own game objects and child game objects.
|
`UIParticle` controls the ParticleSystems that are attached to its own game objects and child game objects.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- **Maskable**: Does this graphic allow maskable.
|
- **Maskable**: Does this graphic allow maskable.
|
||||||
- **Scale**: Scale the rendering particles. When the `3D` toggle is enabled, 3D scale (x, y, z) is supported.
|
- **Scale**: Scale the rendering particles. When the `3D` toggle is enabled, 3D scale (x, y, z) is supported.
|
||||||
@@ -192,6 +201,7 @@ _This package requires **Unity 2018.3 or later**._
|
|||||||
- **UIParticle:** UIParticle.scale will be adjusted.
|
- **UIParticle:** UIParticle.scale will be adjusted.
|
||||||
- **Use Custom View:** Use this if the particles are not displayed correctly due to min/max particle size.
|
- **Use Custom View:** Use this if the particles are not displayed correctly due to min/max particle size.
|
||||||
- **Custom view size:** Change the bake view size.
|
- **Custom view size:** Change the bake view size.
|
||||||
|
- **Time Scale Multiplier:** Time scale multiplier.
|
||||||
- **Rendering Order**: The ParticleSystem list to be rendered. You can change the order and the materials.
|
- **Rendering Order**: The ParticleSystem list to be rendered. You can change the order and the materials.
|
||||||
|
|
||||||
**NOTE:** Press the `Refresh` button to reconstruct the rendering order based on children ParticleSystem's sorting order
|
**NOTE:** Press the `Refresh` button to reconstruct the rendering order based on children ParticleSystem's sorting order
|
||||||
@@ -222,7 +232,7 @@ and z-position.
|
|||||||
If you want to mask particles, set a stencil-supported shader (such as `UI/UIAdditive`) to the material for
|
If you want to mask particles, set a stencil-supported shader (such as `UI/UIAdditive`) to the material for
|
||||||
ParticleSystem.
|
ParticleSystem.
|
||||||
If you use some custom shaders, see
|
If you use some custom shaders, see
|
||||||
the [How to Make a Custom Shader to Support Mask/RectMask2D Component](#how-to-make-a-custom-shader-to-support-maskrectmask2d-component)
|
the [How to Make a Custom Shader to Support Mask/RectMask2D Component](#how-to-make-a-custom-shader-to-support-mask-and-rectmask2d-component)
|
||||||
section.
|
section.
|
||||||
|
|
||||||

|

|
||||||
@@ -269,6 +279,14 @@ uiParticle.Stop();
|
|||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
|
### Project Settings
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- Click `Edit > Project Settings` to open the Project Settings window and then select `UI > UI Particle` category.
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
|
||||||
## 🛠 Development Note
|
## 🛠 Development Note
|
||||||
|
|
||||||
### Compares the Baking mesh approach with the conventional approach
|
### Compares the Baking mesh approach with the conventional approach
|
||||||
|
|||||||
BIN
Packages/src/Runtime/Coffee.UIParticle.R.dll
Normal file
BIN
Packages/src/Runtime/Coffee.UIParticle.R.dll
Normal file
Binary file not shown.
33
Packages/src/Runtime/Coffee.UIParticle.R.dll.meta
Normal file
33
Packages/src/Runtime/Coffee.UIParticle.R.dll.meta
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4d73b3825bf044d418ae21bb331d3902
|
||||||
|
PluginImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
iconMap: {}
|
||||||
|
executionOrder: {}
|
||||||
|
defineConstraints: []
|
||||||
|
isPreloaded: 0
|
||||||
|
isOverridable: 1
|
||||||
|
isExplicitlyReferenced: 0
|
||||||
|
validateReferences: 1
|
||||||
|
platformData:
|
||||||
|
- first:
|
||||||
|
Any:
|
||||||
|
second:
|
||||||
|
enabled: 1
|
||||||
|
settings: {}
|
||||||
|
- first:
|
||||||
|
Editor: Editor
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
DefaultValueInitialized: true
|
||||||
|
- first:
|
||||||
|
Windows Store Apps: WindowsStoreApps
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -18,10 +18,10 @@ namespace Coffee.UIParticleInternal
|
|||||||
public static T[] GetComponentsInChildren<T>(this Component self, int depth)
|
public static T[] GetComponentsInChildren<T>(this Component self, int depth)
|
||||||
where T : Component
|
where T : Component
|
||||||
{
|
{
|
||||||
var results = ListPool<T>.Rent();
|
var results = InternalListPool<T>.Rent();
|
||||||
self.GetComponentsInChildren_Internal(results, depth);
|
self.GetComponentsInChildren_Internal(results, depth);
|
||||||
var array = results.ToArray();
|
var array = results.ToArray();
|
||||||
ListPool<T>.Return(ref results);
|
InternalListPool<T>.Return(ref results);
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,6 +134,35 @@ namespace Coffee.UIParticleInternal
|
|||||||
Profiler.EndSample();
|
Profiler.EndSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a component of a specific type to the children of a GameObject.
|
||||||
|
/// </summary>
|
||||||
|
public static void AddComponentOnChildren<T>(this Component self, bool includeSelf)
|
||||||
|
where T : Component
|
||||||
|
{
|
||||||
|
if (self == null) return;
|
||||||
|
|
||||||
|
Profiler.BeginSample("(COF)[ComponentExt] AddComponentOnChildren > Self");
|
||||||
|
if (includeSelf && !self.TryGetComponent<T>(out _))
|
||||||
|
{
|
||||||
|
self.gameObject.AddComponent<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
Profiler.EndSample();
|
||||||
|
|
||||||
|
Profiler.BeginSample("(COF)[ComponentExt] AddComponentOnChildren > Child");
|
||||||
|
var childCount = self.transform.childCount;
|
||||||
|
for (var i = 0; i < childCount; i++)
|
||||||
|
{
|
||||||
|
var child = self.transform.GetChild(i);
|
||||||
|
if (child.TryGetComponent<T>(out _)) continue;
|
||||||
|
|
||||||
|
child.gameObject.AddComponent<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
Profiler.EndSample();
|
||||||
|
}
|
||||||
|
|
||||||
#if !UNITY_2021_2_OR_NEWER && !UNITY_2020_3_45 && !UNITY_2020_3_46 && !UNITY_2020_3_47 && !UNITY_2020_3_48
|
#if !UNITY_2021_2_OR_NEWER && !UNITY_2020_3_45 && !UNITY_2020_3_46 && !UNITY_2020_3_47 && !UNITY_2020_3_48
|
||||||
public static T GetComponentInParent<T>(this Component self, bool includeInactive) where T : Component
|
public static T GetComponentInParent<T>(this Component self, bool includeInactive) where T : Component
|
||||||
{
|
{
|
||||||
@@ -175,7 +204,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
target.enabled = false;
|
target.enabled = false;
|
||||||
|
|
||||||
// Find MonoScript of the specified component.
|
// Find MonoScript of the specified component.
|
||||||
foreach (var script in Resources.FindObjectsOfTypeAll<MonoScript>())
|
foreach (var script in MonoImporter.GetAllRuntimeMonoScripts())
|
||||||
{
|
{
|
||||||
if (script.GetClass() != typeof(T))
|
if (script.GetClass() != typeof(T))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Coffee.UIParticleInternal
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Extension methods for Component class.
|
|
||||||
/// </summary>
|
|
||||||
internal static class ListExtensions
|
|
||||||
{
|
|
||||||
public static void RemoveAtFast<T>(this List<T> self, int index)
|
|
||||||
{
|
|
||||||
if (self == null) return;
|
|
||||||
|
|
||||||
var lastIndex = self.Count - 1;
|
|
||||||
self[index] = self[lastIndex];
|
|
||||||
self.RemoveAt(lastIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 833553390099d40c9b212823f0852c46
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
using System.Diagnostics;
|
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Coffee.UIParticleInternal
|
|
||||||
{
|
|
||||||
internal static class Misc
|
|
||||||
{
|
|
||||||
public static void Destroy(Object obj)
|
|
||||||
{
|
|
||||||
if (!obj) return;
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
if (!Application.isPlaying)
|
|
||||||
{
|
|
||||||
Object.DestroyImmediate(obj);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
Object.Destroy(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void DestroyImmediate(Object obj)
|
|
||||||
{
|
|
||||||
if (!obj) return;
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
if (Application.isEditor)
|
|
||||||
{
|
|
||||||
Object.DestroyImmediate(obj);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
Object.Destroy(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Conditional("UNITY_EDITOR")]
|
|
||||||
public static void SetDirty(Object obj)
|
|
||||||
{
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
if (!obj) return;
|
|
||||||
EditorUtility.SetDirty(obj);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,11 +17,15 @@ namespace Coffee.UIParticleInternal
|
|||||||
Type.GetType("UnityEditor.Experimental.U2D.SpriteEditorExtension, UnityEditor")
|
Type.GetType("UnityEditor.Experimental.U2D.SpriteEditorExtension, UnityEditor")
|
||||||
?? Type.GetType("UnityEditor.U2D.SpriteEditorExtension, UnityEditor");
|
?? Type.GetType("UnityEditor.U2D.SpriteEditorExtension, UnityEditor");
|
||||||
|
|
||||||
private static readonly MethodInfo s_GetActiveAtlasTextureMethod = s_SpriteEditorExtensionType
|
private static readonly Func<Sprite, Texture2D> s_GetActiveAtlasTextureMethod =
|
||||||
.GetMethod("GetActiveAtlasTexture", BindingFlags.Static | BindingFlags.NonPublic);
|
(Func<Sprite, Texture2D>)Delegate.CreateDelegate(typeof(Func<Sprite, Texture2D>),
|
||||||
|
s_SpriteEditorExtensionType
|
||||||
|
.GetMethod("GetActiveAtlasTexture", BindingFlags.Static | BindingFlags.NonPublic));
|
||||||
|
|
||||||
private static readonly MethodInfo s_GetActiveAtlasMethod = s_SpriteEditorExtensionType
|
private static readonly Func<Sprite, SpriteAtlas> s_GetActiveAtlasMethod =
|
||||||
.GetMethod("GetActiveAtlas", BindingFlags.Static | BindingFlags.NonPublic);
|
(Func<Sprite, SpriteAtlas>)Delegate.CreateDelegate(typeof(Func<Sprite, SpriteAtlas>),
|
||||||
|
s_SpriteEditorExtensionType
|
||||||
|
.GetMethod("GetActiveAtlas", BindingFlags.Static | BindingFlags.NonPublic));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the actual texture of a sprite in play mode or edit mode.
|
/// Get the actual texture of a sprite in play mode or edit mode.
|
||||||
@@ -30,9 +34,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
{
|
{
|
||||||
if (!self) return null;
|
if (!self) return null;
|
||||||
|
|
||||||
if (Application.isPlaying) return self.texture;
|
var ret = s_GetActiveAtlasTextureMethod(self);
|
||||||
|
|
||||||
var ret = s_GetActiveAtlasTextureMethod.Invoke(null, new object[] { self }) as Texture2D;
|
|
||||||
return ret ? ret : self.texture;
|
return ret ? ret : self.texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +45,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
{
|
{
|
||||||
if (!self) return null;
|
if (!self) return null;
|
||||||
|
|
||||||
return s_GetActiveAtlasMethod.Invoke(null, new object[] { self }) as SpriteAtlas;
|
return s_GetActiveAtlasMethod(self);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
using System.IO;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Build;
|
using UnityEditor.Build;
|
||||||
using UnityEditor.Build.Reporting;
|
using UnityEditor.Build.Reporting;
|
||||||
@@ -14,6 +14,14 @@ namespace Coffee.UIParticleInternal
|
|||||||
public abstract class PreloadedProjectSettings : ScriptableObject
|
public abstract class PreloadedProjectSettings : ScriptableObject
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
{
|
{
|
||||||
|
private class Postprocessor : AssetPostprocessor
|
||||||
|
{
|
||||||
|
private static void OnPostprocessAllAssets(string[] _, string[] __, string[] ___, string[] ____)
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class PreprocessBuildWithReport : IPreprocessBuildWithReport
|
private class PreprocessBuildWithReport : IPreprocessBuildWithReport
|
||||||
{
|
{
|
||||||
int IOrderedCallback.callbackOrder => 0;
|
int IOrderedCallback.callbackOrder => 0;
|
||||||
@@ -24,32 +32,32 @@ namespace Coffee.UIParticleInternal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[InitializeOnLoadMethod]
|
|
||||||
[InitializeOnEnterPlayMode]
|
|
||||||
private static void Initialize()
|
private static void Initialize()
|
||||||
{
|
{
|
||||||
const BindingFlags flags = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
|
|
||||||
foreach (var t in TypeCache.GetTypesDerivedFrom(typeof(PreloadedProjectSettings<>)))
|
foreach (var t in TypeCache.GetTypesDerivedFrom(typeof(PreloadedProjectSettings<>)))
|
||||||
{
|
{
|
||||||
var defaultSettings = GetDefaultSettings(t);
|
var defaultSettings = GetDefaultSettings(t);
|
||||||
if (!defaultSettings)
|
if (!defaultSettings)
|
||||||
{
|
{
|
||||||
defaultSettings = t.GetProperty("instance", flags)
|
// When create a new instance, automatically set it as default settings.
|
||||||
?.GetValue(null, null) as PreloadedProjectSettings;
|
defaultSettings = CreateInstance(t) as PreloadedProjectSettings;
|
||||||
SetDefaultSettings(defaultSettings);
|
SetDefaultSettings(defaultSettings);
|
||||||
}
|
}
|
||||||
else if (GetPreloadedSettings(t).Length != 1)
|
else if (GetPreloadedSettings(t).Length != 1)
|
||||||
{
|
{
|
||||||
SetDefaultSettings(defaultSettings);
|
SetDefaultSettings(defaultSettings);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
EditorApplication.QueuePlayerLoopUpdate();
|
if (defaultSettings)
|
||||||
|
{
|
||||||
|
defaultSettings.OnInitialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static string GetDefaultName(Type type, bool nicify)
|
protected static string GetDefaultName(Type type, bool nicify)
|
||||||
{
|
{
|
||||||
var typeName = type.Name.Replace("ProjectSettings", "");
|
var typeName = type.Name;
|
||||||
return nicify
|
return nicify
|
||||||
? ObjectNames.NicifyVariableName(typeName)
|
? ObjectNames.NicifyVariableName(typeName)
|
||||||
: typeName;
|
: typeName;
|
||||||
@@ -73,6 +81,8 @@ namespace Coffee.UIParticleInternal
|
|||||||
|
|
||||||
protected static void SetDefaultSettings(PreloadedProjectSettings asset)
|
protected static void SetDefaultSettings(PreloadedProjectSettings asset)
|
||||||
{
|
{
|
||||||
|
if (!asset) return;
|
||||||
|
|
||||||
var type = asset.GetType();
|
var type = asset.GetType();
|
||||||
if (string.IsNullOrEmpty(AssetDatabase.GetAssetPath(asset)))
|
if (string.IsNullOrEmpty(AssetDatabase.GetAssetPath(asset)))
|
||||||
{
|
{
|
||||||
@@ -83,7 +93,11 @@ namespace Coffee.UIParticleInternal
|
|||||||
|
|
||||||
var assetPath = $"Assets/ProjectSettings/{GetDefaultName(type, false)}.asset";
|
var assetPath = $"Assets/ProjectSettings/{GetDefaultName(type, false)}.asset";
|
||||||
assetPath = AssetDatabase.GenerateUniqueAssetPath(assetPath);
|
assetPath = AssetDatabase.GenerateUniqueAssetPath(assetPath);
|
||||||
AssetDatabase.CreateAsset(asset, assetPath);
|
if (!File.Exists(assetPath))
|
||||||
|
{
|
||||||
|
AssetDatabase.CreateAsset(asset, assetPath);
|
||||||
|
asset.OnCreateAsset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var preloadedAssets = PlayerSettings.GetPreloadedAssets();
|
var preloadedAssets = PlayerSettings.GetPreloadedAssets();
|
||||||
@@ -97,13 +111,20 @@ namespace Coffee.UIParticleInternal
|
|||||||
|
|
||||||
AssetDatabase.Refresh();
|
AssetDatabase.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void OnCreateAsset()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnInitialize()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
public abstract class PreloadedProjectSettings<T> : PreloadedProjectSettings
|
public abstract class PreloadedProjectSettings<T> : PreloadedProjectSettings
|
||||||
where T : PreloadedProjectSettings<T>
|
where T : PreloadedProjectSettings<T>
|
||||||
{
|
{
|
||||||
@@ -112,6 +133,8 @@ namespace Coffee.UIParticleInternal
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
private string _jsonText;
|
private string _jsonText;
|
||||||
|
|
||||||
|
public static bool hasInstance => s_Instance;
|
||||||
|
|
||||||
public static T instance
|
public static T instance
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ namespace Coffee.UIParticleInternal
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal class FastActionBase<T>
|
internal class FastActionBase<T>
|
||||||
{
|
{
|
||||||
private static readonly ObjectPool<LinkedListNode<T>> s_NodePool =
|
private static readonly InternalObjectPool<LinkedListNode<T>> s_NodePool =
|
||||||
new ObjectPool<LinkedListNode<T>>(() => new LinkedListNode<T>(default), _ => true, x => x.Value = default);
|
new InternalObjectPool<LinkedListNode<T>>(() => new LinkedListNode<T>(default), _ => true,
|
||||||
|
x => x.Value = default);
|
||||||
|
|
||||||
private readonly LinkedList<T> _delegates = new LinkedList<T>();
|
private readonly LinkedList<T> _delegates = new LinkedList<T>();
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ namespace Coffee.UIParticleInternal
|
|||||||
GetFrameCache<T>().Set((key1.GetHashCode(), key2.GetHashCode()), result);
|
GetFrameCache<T>().Set((key1.GetHashCode(), key2.GetHashCode()), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets a value in the frame cache with a specified key.
|
/// Sets a value in the frame cache with a specified key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using Object = UnityEngine.Object;
|
|||||||
#if ENABLE_COFFEE_LOGGER
|
#if ENABLE_COFFEE_LOGGER
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
using Conditional = System.Diagnostics.ConditionalAttribute;
|
using Conditional = System.Diagnostics.ConditionalAttribute;
|
||||||
#endif
|
#endif
|
||||||
@@ -43,7 +42,6 @@ namespace Coffee.UIParticleInternal
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !ENABLE_COFFEE_LOGGER
|
#if !ENABLE_COFFEE_LOGGER
|
||||||
[Conditional(k_DisableSymbol)]
|
[Conditional(k_DisableSymbol)]
|
||||||
#endif
|
#endif
|
||||||
@@ -53,7 +51,6 @@ namespace Coffee.UIParticleInternal
|
|||||||
Log_Internal(LogType.Log, tag, message, context ? context : tag as Object);
|
Log_Internal(LogType.Log, tag, message, context ? context : tag as Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !ENABLE_COFFEE_LOGGER
|
#if !ENABLE_COFFEE_LOGGER
|
||||||
[Conditional(k_DisableSymbol)]
|
[Conditional(k_DisableSymbol)]
|
||||||
#endif
|
#endif
|
||||||
@@ -62,7 +59,6 @@ namespace Coffee.UIParticleInternal
|
|||||||
Log_Internal(LogType.Log, tag, message, context ? context : tag as Object);
|
Log_Internal(LogType.Log, tag, message, context ? context : tag as Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !ENABLE_COFFEE_LOGGER
|
#if !ENABLE_COFFEE_LOGGER
|
||||||
[Conditional(k_DisableSymbol)]
|
[Conditional(k_DisableSymbol)]
|
||||||
#endif
|
#endif
|
||||||
@@ -80,7 +76,6 @@ namespace Coffee.UIParticleInternal
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !ENABLE_COFFEE_LOGGER
|
#if !ENABLE_COFFEE_LOGGER
|
||||||
[Conditional(k_DisableSymbol)]
|
[Conditional(k_DisableSymbol)]
|
||||||
#endif
|
#endif
|
||||||
@@ -124,7 +119,6 @@ namespace Coffee.UIParticleInternal
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !ENABLE_COFFEE_LOGGER
|
#if !ENABLE_COFFEE_LOGGER
|
||||||
[Conditional(k_DisableSymbol)]
|
[Conditional(k_DisableSymbol)]
|
||||||
#endif
|
#endif
|
||||||
@@ -170,7 +164,6 @@ namespace Coffee.UIParticleInternal
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !ENABLE_COFFEE_LOGGER
|
#if !ENABLE_COFFEE_LOGGER
|
||||||
[Conditional(k_DisableSymbol)]
|
[Conditional(k_DisableSymbol)]
|
||||||
#endif
|
#endif
|
||||||
@@ -209,7 +202,6 @@ namespace Coffee.UIParticleInternal
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !ENABLE_COFFEE_LOGGER
|
#if !ENABLE_COFFEE_LOGGER
|
||||||
[Conditional(k_DisableSymbol)]
|
[Conditional(k_DisableSymbol)]
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
private static void Clear()
|
public static void Clear()
|
||||||
{
|
{
|
||||||
s_Repository.Clear();
|
s_Repository.Clear();
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,6 @@ namespace Coffee.UIParticleInternal
|
|||||||
Profiler.EndSample();
|
Profiler.EndSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds or retrieves a cached material based on the hash.
|
/// Adds or retrieves a cached material based on the hash.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
132
Packages/src/Runtime/Internal/Utilities/Misc.cs
Normal file
132
Packages/src/Runtime/Internal/Utilities/Misc.cs
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using Object = UnityEngine.Object;
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
#if UNITY_2021_2_OR_NEWER
|
||||||
|
using UnityEditor.SceneManagement;
|
||||||
|
#else
|
||||||
|
using UnityEditor.Experimental.SceneManagement;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace Coffee.UIParticleInternal
|
||||||
|
{
|
||||||
|
internal static class Misc
|
||||||
|
{
|
||||||
|
public static T[] FindObjectsOfType<T>() where T : Object
|
||||||
|
{
|
||||||
|
#if UNITY_2023_1_OR_NEWER
|
||||||
|
return Object.FindObjectsByType<T>(FindObjectsInactive.Include, FindObjectsSortMode.None);
|
||||||
|
#else
|
||||||
|
return Object.FindObjectsOfType<T>();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Destroy(Object obj)
|
||||||
|
{
|
||||||
|
if (!obj) return;
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
if (!Application.isPlaying)
|
||||||
|
{
|
||||||
|
Object.DestroyImmediate(obj);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
Object.Destroy(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DestroyImmediate(Object obj)
|
||||||
|
{
|
||||||
|
if (!obj) return;
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
if (Application.isEditor)
|
||||||
|
{
|
||||||
|
Object.DestroyImmediate(obj);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
Object.Destroy(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Conditional("UNITY_EDITOR")]
|
||||||
|
public static void SetDirty(Object obj)
|
||||||
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
if (!obj) return;
|
||||||
|
EditorUtility.SetDirty(obj);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
public static T[] GetAllComponentsInPrefabStage<T>() where T : Component
|
||||||
|
{
|
||||||
|
var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
|
||||||
|
if (prefabStage == null) return Array.Empty<T>();
|
||||||
|
|
||||||
|
return prefabStage.prefabContentsRoot.GetComponentsInChildren<T>(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool isBatchOrBuilding => Application.isBatchMode || BuildPipeline.isBuildingPlayer;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
[Conditional("UNITY_EDITOR")]
|
||||||
|
public static void QueuePlayerLoopUpdate()
|
||||||
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
if (!EditorApplication.isPlaying)
|
||||||
|
{
|
||||||
|
EditorApplication.QueuePlayerLoopUpdate();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !UNITY_2021_2_OR_NEWER
|
||||||
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
|
[Conditional("UNITY_EDITOR")]
|
||||||
|
internal class IconAttribute : Attribute
|
||||||
|
{
|
||||||
|
private readonly string _path;
|
||||||
|
|
||||||
|
public IconAttribute(string path)
|
||||||
|
{
|
||||||
|
_path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
private static Action<Object, Texture2D> s_SetIconForObject = typeof(EditorGUIUtility)
|
||||||
|
.GetMethod("SetIconForObject", BindingFlags.Static | BindingFlags.NonPublic)
|
||||||
|
.CreateDelegate(typeof(Action<Object, Texture2D>), null) as Action<Object, Texture2D>;
|
||||||
|
|
||||||
|
[InitializeOnLoadMethod]
|
||||||
|
private static void InitializeOnLoadMethod()
|
||||||
|
{
|
||||||
|
if (Misc.isBatchOrBuilding) return;
|
||||||
|
|
||||||
|
var types = TypeCache.GetTypesWithAttribute<IconAttribute>();
|
||||||
|
var scripts = MonoImporter.GetAllRuntimeMonoScripts();
|
||||||
|
foreach (var type in types)
|
||||||
|
{
|
||||||
|
var script = scripts.FirstOrDefault(x => x.GetClass() == type);
|
||||||
|
if (!script) continue;
|
||||||
|
|
||||||
|
var path = type.GetCustomAttribute<IconAttribute>()?._path;
|
||||||
|
var icon = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
|
||||||
|
if (!icon) continue;
|
||||||
|
|
||||||
|
s_SetIconForObject(script, icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 39ed6a6b0a72e482488bd298b2ae762e
|
guid: 182319ecc315e4858b119764af0fbcb0
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -6,15 +6,58 @@ namespace Coffee.UIParticleInternal
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Object pool.
|
/// Object pool.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class ObjectPool<T>
|
internal class InternalObjectPool<T> where T : class
|
||||||
{
|
{
|
||||||
|
#if UNITY_2021_1_OR_NEWER
|
||||||
|
private readonly Predicate<T> _onValid; // Delegate for checking if instances are valid
|
||||||
|
private readonly UnityEngine.Pool.ObjectPool<T> _pool;
|
||||||
|
|
||||||
|
public InternalObjectPool(Func<T> onCreate, Predicate<T> onValid, Action<T> onReturn)
|
||||||
|
{
|
||||||
|
_pool = new UnityEngine.Pool.ObjectPool<T>(onCreate, null, onReturn);
|
||||||
|
_onValid = onValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rent an instance from the pool.
|
||||||
|
/// When you no longer need it, return it with <see cref="Return" />.
|
||||||
|
/// </summary>
|
||||||
|
public T Rent()
|
||||||
|
{
|
||||||
|
while (0 < _pool.CountInactive)
|
||||||
|
{
|
||||||
|
var instance = _pool.Get();
|
||||||
|
if (_onValid(instance))
|
||||||
|
{
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are no instances in the pool, create a new one.
|
||||||
|
Logging.Log(this, $"A new instance is created (pooled: {_pool.CountInactive}, created: {_pool.CountAll}).");
|
||||||
|
return _pool.Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return an instance to the pool and assign null.
|
||||||
|
/// Be sure to return the instance obtained with <see cref="Rent" /> with this method.
|
||||||
|
/// </summary>
|
||||||
|
public void Return(ref T instance)
|
||||||
|
{
|
||||||
|
if (instance == null) return; // Ignore if already pooled or null.
|
||||||
|
|
||||||
|
_pool.Release(instance);
|
||||||
|
Logging.Log(this, $"An instance is released (pooled: {_pool.CountInactive}, created: {_pool.CountAll}).");
|
||||||
|
instance = default; // Set the reference to null.
|
||||||
|
}
|
||||||
|
#else
|
||||||
private readonly Func<T> _onCreate; // Delegate for creating instances
|
private readonly Func<T> _onCreate; // Delegate for creating instances
|
||||||
private readonly Action<T> _onReturn; // Delegate for returning instances to the pool
|
private readonly Action<T> _onReturn; // Delegate for returning instances to the pool
|
||||||
private readonly Predicate<T> _onValid; // Delegate for checking if instances are valid
|
private readonly Predicate<T> _onValid; // Delegate for checking if instances are valid
|
||||||
private readonly Stack<T> _pool = new Stack<T>(32); // Object pool
|
private readonly Stack<T> _pool = new Stack<T>(32); // Object pool
|
||||||
private int _count; // Total count of created instances
|
private int _count; // Total count of created instances
|
||||||
|
|
||||||
public ObjectPool(Func<T> onCreate, Predicate<T> onValid, Action<T> onReturn)
|
public InternalObjectPool(Func<T> onCreate, Predicate<T> onValid, Action<T> onReturn)
|
||||||
{
|
{
|
||||||
_onCreate = onCreate;
|
_onCreate = onCreate;
|
||||||
_onValid = onValid;
|
_onValid = onValid;
|
||||||
@@ -54,15 +97,40 @@ namespace Coffee.UIParticleInternal
|
|||||||
Logging.Log(this, $"An instance is released (pooled: {_pool.Count}, created: {_count}).");
|
Logging.Log(this, $"An instance is released (pooled: {_pool.Count}, created: {_count}).");
|
||||||
instance = default; // Set the reference to null.
|
instance = default; // Set the reference to null.
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Object pool for <see cref="List{T}" />.
|
/// Object pool for <see cref="List{T}" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static class ListPool<T>
|
internal static class InternalListPool<T>
|
||||||
{
|
{
|
||||||
private static readonly ObjectPool<List<T>> s_ListPool =
|
#if UNITY_2021_1_OR_NEWER
|
||||||
new ObjectPool<List<T>>(() => new List<T>(), _ => true, x => x.Clear());
|
/// <summary>
|
||||||
|
/// Rent an instance from the pool.
|
||||||
|
/// When you no longer need it, return it with <see cref="Return" />.
|
||||||
|
/// </summary>
|
||||||
|
public static List<T> Rent()
|
||||||
|
{
|
||||||
|
return UnityEngine.Pool.ListPool<T>.Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return an instance to the pool and assign null.
|
||||||
|
/// Be sure to return the instance obtained with <see cref="Rent" /> with this method.
|
||||||
|
/// </summary>
|
||||||
|
public static void Return(ref List<T> toRelease)
|
||||||
|
{
|
||||||
|
if (toRelease != null)
|
||||||
|
{
|
||||||
|
UnityEngine.Pool.ListPool<T>.Release(toRelease);
|
||||||
|
}
|
||||||
|
|
||||||
|
toRelease = null;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
private static readonly InternalObjectPool<List<T>> s_ListPool =
|
||||||
|
new InternalObjectPool<List<T>>(() => new List<T>(), _ => true, x => x.Clear());
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rent an instance from the pool.
|
/// Rent an instance from the pool.
|
||||||
@@ -81,5 +149,6 @@ namespace Coffee.UIParticleInternal
|
|||||||
{
|
{
|
||||||
s_ListPool.Return(ref toRelease);
|
s_ListPool.Return(ref toRelease);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ namespace Coffee.UIParticleInternal
|
|||||||
private static readonly FastAction s_AfterCanvasRebuildAction = new FastAction();
|
private static readonly FastAction s_AfterCanvasRebuildAction = new FastAction();
|
||||||
private static readonly FastAction s_LateAfterCanvasRebuildAction = new FastAction();
|
private static readonly FastAction s_LateAfterCanvasRebuildAction = new FastAction();
|
||||||
private static readonly FastAction s_BeforeCanvasRebuildAction = new FastAction();
|
private static readonly FastAction s_BeforeCanvasRebuildAction = new FastAction();
|
||||||
|
private static readonly FastAction s_OnScreenSizeChangedAction = new FastAction();
|
||||||
|
private static Vector2Int s_LastScreenSize;
|
||||||
|
|
||||||
static UIExtraCallbacks()
|
static UIExtraCallbacks()
|
||||||
{
|
{
|
||||||
@@ -48,6 +50,15 @@ namespace Coffee.UIParticleInternal
|
|||||||
remove => s_AfterCanvasRebuildAction.Remove(value);
|
remove => s_AfterCanvasRebuildAction.Remove(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event that occurs when the screen size changes.
|
||||||
|
/// </summary>
|
||||||
|
public static event Action onScreenSizeChanged
|
||||||
|
{
|
||||||
|
add => s_OnScreenSizeChangedAction.Add(value);
|
||||||
|
remove => s_OnScreenSizeChangedAction.Remove(value);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes the UIExtraCallbacks to ensure proper event handling.
|
/// Initializes the UIExtraCallbacks to ensure proper event handling.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -77,6 +88,17 @@ namespace Coffee.UIParticleInternal
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static void OnBeforeCanvasRebuild()
|
private static void OnBeforeCanvasRebuild()
|
||||||
{
|
{
|
||||||
|
var screenSize = new Vector2Int(Screen.width, Screen.height);
|
||||||
|
if (s_LastScreenSize != screenSize)
|
||||||
|
{
|
||||||
|
if (s_LastScreenSize != default)
|
||||||
|
{
|
||||||
|
s_OnScreenSizeChangedAction.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
s_LastScreenSize = screenSize;
|
||||||
|
}
|
||||||
|
|
||||||
s_BeforeCanvasRebuildAction.Invoke();
|
s_BeforeCanvasRebuildAction.Invoke();
|
||||||
InitializeAfterCanvasRebuild();
|
InitializeAfterCanvasRebuild();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,15 @@ using UnityEngine.Serialization;
|
|||||||
using Random = UnityEngine.Random;
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("Coffee.UIParticle.Editor")]
|
[assembly: InternalsVisibleTo("Coffee.UIParticle.Editor")]
|
||||||
|
[assembly: InternalsVisibleTo("Coffee.UIParticle.PerformanceDemo")]
|
||||||
|
[assembly: InternalsVisibleTo("Coffee.UIParticle.Demo")]
|
||||||
|
|
||||||
namespace Coffee.UIExtensions
|
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>
|
||||||
|
[Icon("Packages/com.coffee.ui-particle/Icons/UIParticleIcon.png")]
|
||||||
[ExecuteAlways]
|
[ExecuteAlways]
|
||||||
[RequireComponent(typeof(RectTransform))]
|
[RequireComponent(typeof(RectTransform))]
|
||||||
[RequireComponent(typeof(CanvasRenderer))]
|
[RequireComponent(typeof(CanvasRenderer))]
|
||||||
@@ -117,6 +120,10 @@ namespace Coffee.UIExtensions
|
|||||||
"Change the bake view size.")]
|
"Change the bake view size.")]
|
||||||
private float m_CustomViewSize = 10;
|
private float m_CustomViewSize = 10;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
[Tooltip("Time scale multiplier.")]
|
||||||
|
private float m_TimeScaleMultiplier = 1;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private bool m_Maskable = true;
|
private bool m_Maskable = true;
|
||||||
|
|
||||||
@@ -283,6 +290,15 @@ namespace Coffee.UIExtensions
|
|||||||
set => m_CustomViewSize = Mathf.Max(0.1f, value);
|
set => m_CustomViewSize = Mathf.Max(0.1f, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Time scale multiplier.
|
||||||
|
/// </summary>
|
||||||
|
public float timeScaleMultiplier
|
||||||
|
{
|
||||||
|
get => m_TimeScaleMultiplier;
|
||||||
|
set => m_TimeScaleMultiplier = value;
|
||||||
|
}
|
||||||
|
|
||||||
internal bool useMeshSharing => m_MeshSharing != MeshSharing.None;
|
internal bool useMeshSharing => m_MeshSharing != MeshSharing.None;
|
||||||
|
|
||||||
internal bool isPrimary =>
|
internal bool isPrimary =>
|
||||||
@@ -617,12 +633,14 @@ namespace Coffee.UIExtensions
|
|||||||
{
|
{
|
||||||
var ps = particleSystems[i];
|
var ps = particleSystems[i];
|
||||||
if (!ps) continue;
|
if (!ps) continue;
|
||||||
GetRenderer(j++).Set(this, ps, false);
|
|
||||||
|
var mainEmitter = ps.GetMainEmitter(particleSystems);
|
||||||
|
GetRenderer(j++).Set(this, ps, false, mainEmitter);
|
||||||
|
|
||||||
// If the trail is enabled, set it additionally.
|
// If the trail is enabled, set it additionally.
|
||||||
if (ps.trails.enabled)
|
if (ps.trails.enabled)
|
||||||
{
|
{
|
||||||
GetRenderer(j++).Set(this, ps, true);
|
GetRenderer(j++).Set(this, ps, true, mainEmitter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -763,7 +781,7 @@ namespace Coffee.UIExtensions
|
|||||||
_bakeCamera.useOcclusionCulling = false;
|
_bakeCamera.useOcclusionCulling = false;
|
||||||
|
|
||||||
_bakeCamera.gameObject.SetActive(false);
|
_bakeCamera.gameObject.SetActive(false);
|
||||||
_bakeCamera.gameObject.hideFlags = HideFlags.HideAndDontSave;
|
_bakeCamera.gameObject.hideFlags = UIParticleProjectSettings.globalHideFlags;
|
||||||
|
|
||||||
return _bakeCamera;
|
return _bakeCamera;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ MonoImporter:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: 0
|
executionOrder: 0
|
||||||
icon: {fileID: 2800000, guid: 5f0675613942149309588d556e33d990, type: 3}
|
icon: {instanceID: 0}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ namespace Coffee.UIExtensions
|
|||||||
// Collect UIParticle if needed (same size as m_ParticleSystems)
|
// Collect UIParticle if needed (same size as m_ParticleSystems)
|
||||||
CollectUIParticlesIfNeeded();
|
CollectUIParticlesIfNeeded();
|
||||||
|
|
||||||
for (var particleIndex = 0; particleIndex < this.m_ParticleSystems.Count; particleIndex++)
|
for (var particleIndex = 0; particleIndex < m_ParticleSystems.Count; particleIndex++)
|
||||||
{
|
{
|
||||||
var particleSystem = m_ParticleSystems[particleIndex];
|
var particleSystem = m_ParticleSystems[particleIndex];
|
||||||
|
|
||||||
@@ -163,21 +163,21 @@ namespace Coffee.UIExtensions
|
|||||||
particleSystem.GetParticles(particles, count);
|
particleSystem.GetParticles(particles, count);
|
||||||
|
|
||||||
var uiParticle = _uiParticles[particleIndex];
|
var uiParticle = _uiParticles[particleIndex];
|
||||||
var dstPos = this.GetDestinationPosition(uiParticle, particleSystem);
|
var dstPos = GetDestinationPosition(uiParticle, particleSystem);
|
||||||
for (var i = 0; i < count; i++)
|
for (var i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
// Attracted
|
// Attracted
|
||||||
var p = particles[i];
|
var p = particles[i];
|
||||||
if (0f < p.remainingLifetime && Vector3.Distance(p.position, dstPos) < this.m_DestinationRadius)
|
if (0f < p.remainingLifetime && Vector3.Distance(p.position, dstPos) < m_DestinationRadius)
|
||||||
{
|
{
|
||||||
p.remainingLifetime = 0f;
|
p.remainingLifetime = 0f;
|
||||||
particles[i] = p;
|
particles[i] = p;
|
||||||
|
|
||||||
if (this.m_OnAttracted != null)
|
if (m_OnAttracted != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.m_OnAttracted.Invoke();
|
m_OnAttracted.Invoke();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -189,7 +189,7 @@ namespace Coffee.UIExtensions
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calc attracting time
|
// Calc attracting time
|
||||||
var delayTime = p.startLifetime * this.m_DelayRate;
|
var delayTime = p.startLifetime * m_DelayRate;
|
||||||
var duration = p.startLifetime - delayTime;
|
var duration = p.startLifetime - delayTime;
|
||||||
var time = Mathf.Max(0, p.startLifetime - p.remainingLifetime - delayTime);
|
var time = Mathf.Max(0, p.startLifetime - p.remainingLifetime - delayTime);
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ namespace Coffee.UIExtensions
|
|||||||
if (time <= 0) continue;
|
if (time <= 0) continue;
|
||||||
|
|
||||||
// Attract
|
// Attract
|
||||||
p.position = this.GetAttractedPosition(p.position, dstPos, duration, time);
|
p.position = GetAttractedPosition(p.position, dstPos, duration, time);
|
||||||
p.velocity *= 0.5f;
|
p.velocity *= 0.5f;
|
||||||
particles[i] = p;
|
particles[i] = p;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ MonoImporter:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: 0
|
executionOrder: 0
|
||||||
icon: {instanceID: 0}
|
icon: {fileID: 2800000, guid: 5f0675613942149309588d556e33d990, type: 3}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
||||||
|
|||||||
@@ -17,6 +17,18 @@ namespace Coffee.UIExtensions
|
|||||||
set => instance.m_EnableLinearToGamma = value;
|
set => instance.m_EnableLinearToGamma = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Header("Editor")]
|
||||||
|
[Tooltip("Hide the automatically generated objects.\n" +
|
||||||
|
" - UIParticleRenderer\n" +
|
||||||
|
" - UIParticle BakingCamera")]
|
||||||
|
[SerializeField]
|
||||||
|
private bool m_HideGeneratedObjects = true;
|
||||||
|
|
||||||
|
public static HideFlags globalHideFlags => instance.m_HideGeneratedObjects
|
||||||
|
? HideFlags.DontSave | HideFlags.NotEditable | HideFlags.HideInHierarchy | HideFlags.HideInInspector
|
||||||
|
: HideFlags.DontSave | HideFlags.NotEditable;
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
[SettingsProvider]
|
[SettingsProvider]
|
||||||
private static SettingsProvider CreateSettingsProvider()
|
private static SettingsProvider CreateSettingsProvider()
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ MonoImporter:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: 0
|
executionOrder: 0
|
||||||
icon: {instanceID: 0}
|
icon: {fileID: 2800000, guid: 5f0675613942149309588d556e33d990, type: 3}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#elif UNITY_2022_3_OR_NEWER
|
#elif UNITY_2022_3_OR_NEWER
|
||||||
#define PS_BAKE_API_V2
|
#define PS_BAKE_API_V2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Coffee.UIParticleInternal;
|
using Coffee.UIParticleInternal;
|
||||||
@@ -16,6 +15,7 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
namespace Coffee.UIExtensions
|
namespace Coffee.UIExtensions
|
||||||
{
|
{
|
||||||
|
[Icon("Packages/com.coffee.ui-particle/Icons/UIParticleIcon.png")]
|
||||||
[ExecuteAlways]
|
[ExecuteAlways]
|
||||||
[RequireComponent(typeof(RectTransform))]
|
[RequireComponent(typeof(RectTransform))]
|
||||||
[RequireComponent(typeof(CanvasRenderer))]
|
[RequireComponent(typeof(CanvasRenderer))]
|
||||||
@@ -41,6 +41,7 @@ namespace Coffee.UIExtensions
|
|||||||
private Vector2Int _prevScreenSize;
|
private Vector2Int _prevScreenSize;
|
||||||
private bool _preWarm;
|
private bool _preWarm;
|
||||||
private ParticleSystemRenderer _renderer;
|
private ParticleSystemRenderer _renderer;
|
||||||
|
private ParticleSystem _mainEmitter;
|
||||||
|
|
||||||
public override Texture mainTexture => _isTrail ? null : _particleSystem.GetTextureForSprite();
|
public override Texture mainTexture => _isTrail ? null : _particleSystem.GetTextureForSprite();
|
||||||
|
|
||||||
@@ -113,6 +114,7 @@ namespace Coffee.UIExtensions
|
|||||||
_parent = null;
|
_parent = null;
|
||||||
_particleSystem = null;
|
_particleSystem = null;
|
||||||
_renderer = null;
|
_renderer = null;
|
||||||
|
_mainEmitter = null;
|
||||||
if (0 <= index)
|
if (0 <= index)
|
||||||
{
|
{
|
||||||
_index = index;
|
_index = index;
|
||||||
@@ -137,6 +139,7 @@ namespace Coffee.UIExtensions
|
|||||||
{
|
{
|
||||||
base.OnEnable();
|
base.OnEnable();
|
||||||
|
|
||||||
|
hideFlags = UIParticleProjectSettings.globalHideFlags;
|
||||||
if (!s_CombineInstances[0].mesh)
|
if (!s_CombineInstances[0].mesh)
|
||||||
{
|
{
|
||||||
s_CombineInstances[0].mesh = new Mesh
|
s_CombineInstances[0].mesh = new Mesh
|
||||||
@@ -161,7 +164,7 @@ namespace Coffee.UIExtensions
|
|||||||
// Create renderer object.
|
// Create renderer object.
|
||||||
var go = new GameObject("[generated] UIParticleRenderer", typeof(UIParticleRenderer))
|
var go = new GameObject("[generated] UIParticleRenderer", typeof(UIParticleRenderer))
|
||||||
{
|
{
|
||||||
hideFlags = HideFlags.HideAndDontSave,
|
hideFlags = UIParticleProjectSettings.globalHideFlags,
|
||||||
layer = parent.gameObject.layer
|
layer = parent.gameObject.layer
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -201,7 +204,6 @@ namespace Coffee.UIExtensions
|
|||||||
return modifiedMaterial;
|
return modifiedMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
var hash = new Hash128(
|
var hash = new Hash128(
|
||||||
modifiedMaterial ? (uint)modifiedMaterial.GetInstanceID() : 0,
|
modifiedMaterial ? (uint)modifiedMaterial.GetInstanceID() : 0,
|
||||||
texture ? (uint)texture.GetInstanceID() : 0,
|
texture ? (uint)texture.GetInstanceID() : 0,
|
||||||
@@ -224,7 +226,7 @@ namespace Coffee.UIExtensions
|
|||||||
return _modifiedMaterial;
|
return _modifiedMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set(UIParticle parent, ParticleSystem ps, bool isTrail)
|
public void Set(UIParticle parent, ParticleSystem ps, bool isTrail, ParticleSystem mainEmitter)
|
||||||
{
|
{
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
maskable = parent.maskable;
|
maskable = parent.maskable;
|
||||||
@@ -247,10 +249,7 @@ namespace Coffee.UIExtensions
|
|||||||
|
|
||||||
ps.TryGetComponent(out _renderer);
|
ps.TryGetComponent(out _renderer);
|
||||||
_renderer.enabled = false;
|
_renderer.enabled = false;
|
||||||
|
|
||||||
//_emitter = emitter;
|
|
||||||
_isTrail = isTrail;
|
_isTrail = isTrail;
|
||||||
|
|
||||||
_renderer.GetSharedMaterials(s_Materials);
|
_renderer.GetSharedMaterials(s_Materials);
|
||||||
material = s_Materials[isTrail ? 1 : 0];
|
material = s_Materials[isTrail ? 1 : 0];
|
||||||
s_Materials.Clear();
|
s_Materials.Clear();
|
||||||
@@ -267,6 +266,7 @@ namespace Coffee.UIExtensions
|
|||||||
_prevScreenSize = new Vector2Int(Screen.width, Screen.height);
|
_prevScreenSize = new Vector2Int(Screen.width, Screen.height);
|
||||||
_prevCanvasScale = canvas ? canvas.scaleFactor : 1f;
|
_prevCanvasScale = canvas ? canvas.scaleFactor : 1f;
|
||||||
_delay = true;
|
_delay = true;
|
||||||
|
_mainEmitter = mainEmitter;
|
||||||
|
|
||||||
canvasRenderer.SetTexture(null);
|
canvasRenderer.SetTexture(null);
|
||||||
|
|
||||||
@@ -304,7 +304,7 @@ namespace Coffee.UIExtensions
|
|||||||
|
|
||||||
// Simulate particles.
|
// Simulate particles.
|
||||||
Profiler.BeginSample("[UIParticle] Bake Mesh > Simulate Particles");
|
Profiler.BeginSample("[UIParticle] Bake Mesh > Simulate Particles");
|
||||||
if (!_isTrail && _parent.canSimulate)
|
if (!_isTrail && _parent.canSimulate && !_mainEmitter)
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
if (!Application.isPlaying)
|
if (!Application.isPlaying)
|
||||||
@@ -422,17 +422,16 @@ namespace Coffee.UIExtensions
|
|||||||
workerMesh.LinearToGamma();
|
workerMesh.LinearToGamma();
|
||||||
}
|
}
|
||||||
|
|
||||||
var components = ListPool<Component>.Rent();
|
var components = InternalListPool<Component>.Rent();
|
||||||
GetComponents(typeof(IMeshModifier), components);
|
GetComponents(typeof(IMeshModifier), components);
|
||||||
|
|
||||||
#pragma warning disable CS0618 // Type or member is obsolete
|
|
||||||
for (var i = 0; i < components.Count; i++)
|
for (var i = 0; i < components.Count; i++)
|
||||||
{
|
{
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
((IMeshModifier)components[i]).ModifyMesh(workerMesh);
|
((IMeshModifier)components[i]).ModifyMesh(workerMesh);
|
||||||
}
|
|
||||||
#pragma warning restore CS0618 // Type or member is obsolete
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
|
}
|
||||||
|
|
||||||
ListPool<Component>.Return(ref components);
|
InternalListPool<Component>.Return(ref components);
|
||||||
}
|
}
|
||||||
|
|
||||||
Profiler.EndSample();
|
Profiler.EndSample();
|
||||||
@@ -444,7 +443,7 @@ namespace Coffee.UIExtensions
|
|||||||
|
|
||||||
// Get grouped renderers.
|
// Get grouped renderers.
|
||||||
Profiler.BeginSample("[UIParticleRenderer] Set Mesh");
|
Profiler.BeginSample("[UIParticleRenderer] Set Mesh");
|
||||||
var renderers = ListPool<UIParticleRenderer>.Rent();
|
var renderers = InternalListPool<UIParticleRenderer>.Rent();
|
||||||
if (_parent.useMeshSharing)
|
if (_parent.useMeshSharing)
|
||||||
{
|
{
|
||||||
UIParticleUpdater.GetGroupedRenderers(_parent.groupId, _index, renderers);
|
UIParticleUpdater.GetGroupedRenderers(_parent.groupId, _index, renderers);
|
||||||
@@ -461,7 +460,7 @@ namespace Coffee.UIExtensions
|
|||||||
r.canvasRenderer.SetMaterial(materialForRendering, 0);
|
r.canvasRenderer.SetMaterial(materialForRendering, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListPool<UIParticleRenderer>.Return(ref renderers);
|
InternalListPool<UIParticleRenderer>.Return(ref renderers);
|
||||||
|
|
||||||
if (_parent.canRender)
|
if (_parent.canRender)
|
||||||
{
|
{
|
||||||
@@ -544,6 +543,30 @@ 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_mainEmitter)
|
||||||
|
{
|
||||||
|
if (_mainEmitter.IsLocalSpace())
|
||||||
|
{
|
||||||
|
return Matrix4x4.Translate(psPos)
|
||||||
|
* Matrix4x4.Scale(scale)
|
||||||
|
* Matrix4x4.Translate(-psPos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
psPos = _particleSystem.transform.position - _mainEmitter.transform.position;
|
||||||
|
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))
|
||||||
@@ -606,6 +629,7 @@ namespace Coffee.UIExtensions
|
|||||||
: main.useUnscaledTime
|
: main.useUnscaledTime
|
||||||
? Time.unscaledDeltaTime
|
? Time.unscaledDeltaTime
|
||||||
: Time.deltaTime;
|
: Time.deltaTime;
|
||||||
|
deltaTime *= _parent.timeScaleMultiplier;
|
||||||
|
|
||||||
// Pre-warm:
|
// Pre-warm:
|
||||||
if (0 < deltaTime && _preWarm)
|
if (0 < deltaTime && _preWarm)
|
||||||
|
|||||||
@@ -40,13 +40,26 @@ namespace Coffee.UIExtensions
|
|||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
[InitializeOnLoadMethod]
|
[InitializeOnLoadMethod]
|
||||||
|
private static void InitializeOnLoad()
|
||||||
|
{
|
||||||
|
UIExtraCallbacks.onAfterCanvasRebuild += Refresh;
|
||||||
|
|
||||||
|
EditorApplication.playModeStateChanged += state =>
|
||||||
|
{
|
||||||
|
UIExtraCallbacks.onAfterCanvasRebuild -= Refresh;
|
||||||
|
if (state == PlayModeStateChange.EnteredEditMode || state == PlayModeStateChange.EnteredPlayMode)
|
||||||
|
{
|
||||||
|
UIExtraCallbacks.onAfterCanvasRebuild += Refresh;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||||
#endif
|
|
||||||
private static void InitializeOnLoad()
|
private static void InitializeOnLoad()
|
||||||
{
|
{
|
||||||
UIExtraCallbacks.onAfterCanvasRebuild += Refresh;
|
UIExtraCallbacks.onAfterCanvasRebuild += Refresh;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private static void Refresh()
|
private static void Refresh()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -171,5 +171,32 @@ namespace Coffee.UIParticleInternal
|
|||||||
action.Invoke(p);
|
action.Invoke(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ParticleSystem GetMainEmitter(this ParticleSystem self, List<ParticleSystem> list)
|
||||||
|
{
|
||||||
|
if (!self || list == null || list.Count == 0) return null;
|
||||||
|
|
||||||
|
for (var i = 0; i < list.Count; i++)
|
||||||
|
{
|
||||||
|
var parent = list[i];
|
||||||
|
if (parent != self && IsSubEmitterOf(self, parent)) return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsSubEmitterOf(this ParticleSystem self, ParticleSystem parent)
|
||||||
|
{
|
||||||
|
if (!self || !parent) return false;
|
||||||
|
|
||||||
|
var subEmitters = parent.subEmitters;
|
||||||
|
var count = subEmitters.subEmittersCount;
|
||||||
|
for (var i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
if (subEmitters.GetSubEmitterSystem(i) == self) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Coffee.UIParticleInternal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Serialization;
|
using UnityEngine.Serialization;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@@ -51,11 +52,7 @@ namespace Coffee.UIExtensions.Demo
|
|||||||
|
|
||||||
public void EnableAnimations(bool flag)
|
public void EnableAnimations(bool flag)
|
||||||
{
|
{
|
||||||
#if UNITY_2023_1_OR_NEWER
|
foreach (var animator in Misc.FindObjectsOfType<Animator>())
|
||||||
foreach (var animator in FindObjectsByType<Animator>(FindObjectsInactive.Include, FindObjectsSortMode.None))
|
|
||||||
#else
|
|
||||||
foreach (var animator in FindObjectsOfType<Animator>())
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
animator.enabled = flag;
|
animator.enabled = flag;
|
||||||
}
|
}
|
||||||
@@ -83,11 +80,7 @@ namespace Coffee.UIExtensions.Demo
|
|||||||
|
|
||||||
public void UIParticle_Scale(float scale)
|
public void UIParticle_Scale(float scale)
|
||||||
{
|
{
|
||||||
#if UNITY_2023_1_OR_NEWER
|
foreach (var uip in Misc.FindObjectsOfType<UIParticle>())
|
||||||
foreach (var uip in FindObjectsByType<UIParticle>(FindObjectsInactive.Include, FindObjectsSortMode.None))
|
|
||||||
#else
|
|
||||||
foreach (var uip in FindObjectsOfType<UIParticle>())
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
uip.scale = scale;
|
uip.scale = scale;
|
||||||
}
|
}
|
||||||
@@ -95,11 +88,7 @@ namespace Coffee.UIExtensions.Demo
|
|||||||
|
|
||||||
public void ParticleSystem_WorldSpaseSimulation(bool flag)
|
public void ParticleSystem_WorldSpaseSimulation(bool flag)
|
||||||
{
|
{
|
||||||
#if UNITY_2023_1_OR_NEWER
|
foreach (var p in Misc.FindObjectsOfType<ParticleSystem>())
|
||||||
foreach (var p in FindObjectsByType<ParticleSystem>(FindObjectsInactive.Include, FindObjectsSortMode.None))
|
|
||||||
#else
|
|
||||||
foreach (var p in FindObjectsOfType<ParticleSystem>())
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
var main = p.main;
|
var main = p.main;
|
||||||
main.simulationSpace = flag
|
main.simulationSpace = flag
|
||||||
@@ -135,11 +124,7 @@ namespace Coffee.UIExtensions.Demo
|
|||||||
|
|
||||||
public void ParticleSystem_SetScale(float scale)
|
public void ParticleSystem_SetScale(float scale)
|
||||||
{
|
{
|
||||||
#if UNITY_2023_1_OR_NEWER
|
foreach (var ps in Misc.FindObjectsOfType<ParticleSystem>())
|
||||||
foreach (var ps in FindObjectsByType<ParticleSystem>(FindObjectsInactive.Include, FindObjectsSortMode.None))
|
|
||||||
#else
|
|
||||||
foreach (var ps in FindObjectsOfType<ParticleSystem>())
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
ps.transform.localScale = new Vector3(scale, scale, scale);
|
ps.transform.localScale = new Vector3(scale, scale, scale);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,10 @@
|
|||||||
Lighting Off
|
Lighting Off
|
||||||
ZWrite Off
|
ZWrite Off
|
||||||
ZTest [unity_GUIZTestMode]
|
ZTest [unity_GUIZTestMode]
|
||||||
Fog { Mode Off }
|
Fog
|
||||||
|
{
|
||||||
|
Mode Off
|
||||||
|
}
|
||||||
Blend One One
|
Blend One One
|
||||||
|
|
||||||
ColorMask [_ColorMask]
|
ColorMask [_ColorMask]
|
||||||
@@ -61,21 +64,21 @@
|
|||||||
|
|
||||||
struct appdata_t
|
struct appdata_t
|
||||||
{
|
{
|
||||||
float4 vertex : POSITION;
|
float4 vertex : POSITION;
|
||||||
float4 color : COLOR;
|
float4 color : COLOR;
|
||||||
float2 texcoord : TEXCOORD0;
|
float2 texcoord : TEXCOORD0;
|
||||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||||
};
|
};
|
||||||
|
|
||||||
struct v2f
|
struct v2f
|
||||||
{
|
{
|
||||||
float4 vertex : SV_POSITION;
|
float4 vertex : SV_POSITION;
|
||||||
fixed4 color : COLOR;
|
fixed4 color : COLOR;
|
||||||
float2 texcoord : TEXCOORD0;
|
float2 texcoord : TEXCOORD0;
|
||||||
float4 worldPosition : TEXCOORD1;
|
float4 worldPosition : TEXCOORD1;
|
||||||
UNITY_VERTEX_OUTPUT_STEREO
|
UNITY_VERTEX_OUTPUT_STEREO
|
||||||
};
|
};
|
||||||
|
|
||||||
fixed4 _Color;
|
fixed4 _Color;
|
||||||
sampler2D _MainTex;
|
sampler2D _MainTex;
|
||||||
float4 _MainTex_ST;
|
float4 _MainTex_ST;
|
||||||
@@ -114,4 +117,4 @@
|
|||||||
ENDCG
|
ENDCG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
"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": "4.9.0",
|
"version": "5.0.0-preview.16",
|
||||||
"unity": "2018.2",
|
"unity": "2019.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
11
ProjectSettings/MinimalResourceSettings.json
Normal file
11
ProjectSettings/MinimalResourceSettings.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"MonoBehaviour": {
|
||||||
|
"m_Enabled": true,
|
||||||
|
"m_EditorHideFlags": 0,
|
||||||
|
"m_Name": "",
|
||||||
|
"m_EditorClassIdentifier": "",
|
||||||
|
"m_OutputDllPaths": [
|
||||||
|
"Packages/com.coffee.ui-particle/Runtime/Coffee.UIParticle.R.dll"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -124,7 +124,7 @@ PlayerSettings:
|
|||||||
bundleVersion: 1.0
|
bundleVersion: 1.0
|
||||||
preloadedAssets:
|
preloadedAssets:
|
||||||
- {fileID: 11400000, guid: 86087a0847f384b538391745dad4565c, type: 2}
|
- {fileID: 11400000, guid: 86087a0847f384b538391745dad4565c, type: 2}
|
||||||
- {fileID: 11400000, guid: e8e7744b163af4869b07b8f192c810ed, type: 2}
|
- {fileID: 11400000, guid: 4b9df7b8a4193489299b8f477348ae0c, type: 2}
|
||||||
metroInputSource: 0
|
metroInputSource: 0
|
||||||
wsaTransparentSwapchain: 0
|
wsaTransparentSwapchain: 0
|
||||||
m_HolographicPauseOnTrackingLoss: 1
|
m_HolographicPauseOnTrackingLoss: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user