mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-19 17:22:37 +08:00
Compare commits
104 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 76f1478523 | |||
| afbfcdd40c | |||
| c34c2ec0c2 | |||
| da6651ae65 | |||
| 255d600275 | |||
| d359086ed4 | |||
| 6e8aaf36f0 | |||
| 27629cdd7c | |||
| bb2efc0790 | |||
| d41d1ad21f | |||
| 739ae50549 | |||
| 3ca1214233 | |||
| fb75fd4817 | |||
| 2c1d857119 | |||
| e856b0b939 | |||
| 6cbb793d8d | |||
| 485e2df9fc | |||
| 4a49e9a8b2 | |||
| af0ae7bdf7 | |||
| d1fa0d143f | |||
| 55a7f27204 | |||
| ff824c2341 | |||
| 014bba3f56 | |||
| f533d02977 | |||
| 8bb782c90a | |||
| 2617f77c6a | |||
| 1f4427c3d5 | |||
| 2dcb7f7e86 | |||
| 0a4229907d | |||
| dbf8ae00f5 | |||
| cacb9fde45 | |||
| 9d980961d6 | |||
| 399f25db2a | |||
| 161fc546ca | |||
| 96f9d09ac7 | |||
| cb07e1f25e | |||
| 7525c782ef | |||
| 9aaa0de59d | |||
| a556c28221 | |||
| 0fb08bf202 | |||
| 55e3030dd2 | |||
| d2c0789375 | |||
| a373cf772b | |||
| ec3fb13c11 | |||
| 514d5f0347 | |||
| dfe91edac1 | |||
| 8f3c990a3a | |||
| e8b1b5f89e | |||
| ae7ffad789 | |||
| c7696c09c0 | |||
| b6b538f64f | |||
| 730aa2bb4d | |||
| 546d603674 | |||
| e955715c99 | |||
| 72bb1c5131 | |||
| f538ef2cba | |||
| ae483ec577 | |||
| facb78262c | |||
| a2c550c523 | |||
| 44cf12173f | |||
| d7abcc47f1 | |||
| 57031c3e3c | |||
| cd68b364c4 | |||
| f3da972c0c | |||
| 2d6f7ed63d | |||
| 70937d2ce3 | |||
| 4a4e50e01f | |||
| 815162eab9 | |||
| 7fc0c7364d | |||
| 20e7f2fa61 | |||
| 1b292febb7 | |||
| 6b79864a39 | |||
| 4e30651290 | |||
| 87760570ec | |||
| ef7ac0aaad | |||
| 2fd87e909a | |||
| 2cc5c5b68e | |||
| 4a8d341625 | |||
| a885fc5bc1 | |||
| 4fdd9636fa | |||
| 06a280ec5a | |||
| e6fb78a0f6 | |||
| 451cbe4302 | |||
| 3cae638bdd | |||
| 533d7b8c0a | |||
| 9380f96572 | |||
| b4adb32512 | |||
| 59874ddffe | |||
| c4202b45d2 | |||
| ce692580a3 | |||
| 6c808aa341 | |||
| a975cf347a | |||
| 3207105a06 | |||
| 4cca2fb5ab | |||
| d1adb33884 | |||
| b077d97ed7 | |||
| 6f90044ec8 | |||
| 83128ebb09 | |||
| 9dffdb0ed8 | |||
| 16be53e145 | |||
| fd2d1b8059 | |||
| cf43bfffb9 | |||
| a2f4a2d5c9 | |||
| 0d7fb1eb63 |
@@ -22,7 +22,7 @@ jobs:
|
||||
find _site -name __MACOSX | xargs rm -rf
|
||||
|
||||
- name: 📦 Upload '_site'
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
uses: actions/upload-pages-artifact@v5
|
||||
|
||||
- name: 🚀 Deploy To GitHub Pages
|
||||
uses: actions/deploy-pages@v4
|
||||
uses: actions/deploy-pages@v5
|
||||
|
||||
@@ -25,18 +25,19 @@ jobs:
|
||||
tag: ${{ steps.release.outputs.new_release_git_tag }}
|
||||
steps:
|
||||
- name: 🚚 Checkout (${{ github.ref_name }})
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: 🔖 Run semantic release
|
||||
uses: cycjimmy/semantic-release-action@v4
|
||||
uses: cycjimmy/semantic-release-action@v6
|
||||
id: release
|
||||
with:
|
||||
working_directory: Packages/src
|
||||
extra_plugins: |
|
||||
@semantic-release/changelog
|
||||
@semantic-release/exec
|
||||
@semantic-release/git
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
- run: |
|
||||
echo "🔖 New release published: '${{ steps.release.outputs.new_release_published }}'" | tee -a $GITHUB_STEP_SUMMARY
|
||||
|
||||
@@ -8,17 +8,28 @@ run-name: 🧪 Test URP (${{ github.event.pull_request.title || github.ref_name
|
||||
env:
|
||||
# MINIMUM_VERSION: The minimum version of Unity.
|
||||
MINIMUM_VERSION: 6000.0
|
||||
MAXIMUM_VERSION:
|
||||
# EXCLUDE_FILTER: The excluded versions of Unity.
|
||||
EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.2|2023.3)"
|
||||
EXCLUDE_FILTER: "(2017|2018|2023.3)"
|
||||
IGNORE_ALPHA: false
|
||||
IGNORE_BETA: false
|
||||
PROJECT_PATH: UIEffectURP
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
unityVersions:
|
||||
description: 'Specify the Unity versions to test. (eg. [ "2019.4.41f2", "2020.3.15f2" ])'
|
||||
required: false
|
||||
default: '[ "6000.0.0f1", "6000.1.0f1" ]'
|
||||
usePeriodVersions:
|
||||
description: "Use the period versions (.0f1, .10f1, 20f1, ...)."
|
||||
description: 'Use the period versions (.0f1, .10f1, 20f1, ...).'
|
||||
required: false
|
||||
default: "true"
|
||||
overrideFindOptions:
|
||||
description: 'Specify options for unity-changeset. (eg. --ignore-alpha --max 2020.3 )'
|
||||
required: false
|
||||
default: '--min 6000.0 --max 9999.9 --ignore-alpha --ignore-beta'
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
@@ -27,7 +38,7 @@ on:
|
||||
- "!*"
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
pull_request_target:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
@@ -39,16 +50,48 @@ jobs:
|
||||
setup:
|
||||
name: ⚙️ Setup
|
||||
runs-on: ubuntu-latest
|
||||
permissions: {} # No permissions needed for setup job
|
||||
outputs:
|
||||
unityVersions: ${{ steps.setup.outputs.unityVersions }}
|
||||
steps:
|
||||
- name: 🔑 Secrets check
|
||||
run: |
|
||||
echo "Checking secrets for ${{ github.actor }} ..."
|
||||
if [ -z "$UNITY_EMAIL" ] || [ -z "$UNITY_PASSWORD" ] || [ -z "$UNITY_LICENSE" ]; then
|
||||
echo "Error: UNITY_EMAIL, UNITY_PASSWORD, and UNITY_LICENSE secrets must be set." | tee -a $GITHUB_STEP_SUMMARY >&2
|
||||
echo "Error: See https://game.ci/docs/github/test-runner#basic-setup" | tee -a $GITHUB_STEP_SUMMARY >&2
|
||||
echo "Error: Set the secrets at ${{ github.server_url }}/${{ github.repository }}/settings/secrets/actions" | tee -a $GITHUB_STEP_SUMMARY >&2
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
- name: ⚙️ Find target Unity versions
|
||||
id: setup
|
||||
run: |
|
||||
echo "==== Target Unity Versions ===="
|
||||
LATEST_VERSIONS=`npx unity-changeset list --versions --latest-patch --min ${MINIMUM_VERSION} --json --all`
|
||||
|
||||
# Check if specific Unity versions are provided via inputs (for workflow_dispatch)
|
||||
if [ -n "${{ inputs.unityVersions }}" ]; then
|
||||
echo "* Using specified Unity versions" | tee $GITHUB_OUTPUT
|
||||
echo 'unityVersions=${{ inputs.unityVersions }}' | tee $GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Formulate find options based on inputs and environment variables
|
||||
FIND_OPTIONS=""
|
||||
[ "${{ env.IGNORE_ALPHA }}" = "true" ] && FIND_OPTIONS+=" --ignore-alpha"
|
||||
[ "${{ env.IGNORE_BETA }}" = "true" ] && FIND_OPTIONS+=" --ignore-beta"
|
||||
[ -n "${{ env.MINIMUM_VERSION }}" ] && FIND_OPTIONS+=" --min ${MINIMUM_VERSION}"
|
||||
[ -n "${{ env.MAXIMUM_VERSION }}" ] && FIND_OPTIONS+=" --max ${MAXIMUM_VERSION}"
|
||||
[ -n "${{ inputs.overrideFindOptions }}" ] && FIND_OPTIONS="${inputs.overrideFindOptions}"
|
||||
echo "find options: $FIND_OPTIONS"
|
||||
|
||||
# Find the latest Unity versions if no specific versions are provided
|
||||
LATEST_VERSIONS=`npx -y unity-changeset@latest list --json --versions --all --latest-patch $FIND_OPTIONS`
|
||||
if [ "${{ inputs.usePeriodVersions }}" = "true" ]; then
|
||||
ADDITIONAL_VERSIONS=`npx unity-changeset list --versions --grep '0f' --min ${MINIMUM_VERSION} --json`
|
||||
ADDITIONAL_VERSIONS=`npx -y unity-changeset@latest list --json --versions $FIND_OPTIONS --grep '0f'`
|
||||
else
|
||||
ADDITIONAL_VERSIONS=[]
|
||||
fi
|
||||
@@ -66,39 +109,24 @@ jobs:
|
||||
needs: setup
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 6
|
||||
max-parallel: 8
|
||||
matrix:
|
||||
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
|
||||
steps:
|
||||
- name: 🚚 Checkout ($${{ github.ref }})
|
||||
if: github.event_name == 'push'
|
||||
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
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: 📥 Cache library
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
|
||||
path: ${{ env.PROJECT_PATH }}/Library
|
||||
key: ${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
|
||||
restore-keys: |
|
||||
Library-${{ matrix.unityVersion }}-
|
||||
Library-
|
||||
${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-
|
||||
${{ env.PROJECT_PATH }}-Library-
|
||||
|
||||
- name: 🛠️ Build Unity Project (Test)
|
||||
uses: game-ci/unity-builder@v4
|
||||
uses: mob-sakai/unity-builder@fix/support-unity6.6
|
||||
timeout-minutes: 45
|
||||
with:
|
||||
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
@@ -111,16 +139,17 @@ jobs:
|
||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
# - name: 🧪 Run tests
|
||||
# uses: game-ci/unity-test-runner@v4
|
||||
# timeout-minutes: 45
|
||||
# with:
|
||||
# customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
# # unityVersion: ${{ matrix.unityVersion }}
|
||||
# customParameters: -nographics
|
||||
# checkName: ${{ matrix.unityVersion }} Test Results
|
||||
# githubToken: ${{ github.token }}
|
||||
# env:
|
||||
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
# - name: 🧪 Run tests
|
||||
# uses: mob-sakai/unity-test-runner@fix/support-unity6.6
|
||||
# timeout-minutes: 45
|
||||
# with:
|
||||
# customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
# # unityVersion: ${{ matrix.unityVersion }}
|
||||
# customParameters: -nographics
|
||||
# checkName: ${{ matrix.unityVersion }} Test Results
|
||||
# githubToken: ${{ github.token }}
|
||||
# projectPath: ${{ env.PROJECT_PATH }}
|
||||
# env:
|
||||
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
+57
-30
@@ -8,17 +8,28 @@ run-name: 🧪 Test (${{ github.event.pull_request.title || github.ref_name }})
|
||||
env:
|
||||
# MINIMUM_VERSION: The minimum version of Unity.
|
||||
MINIMUM_VERSION: 2020.3
|
||||
MAXIMUM_VERSION: 6000.7.99
|
||||
# EXCLUDE_FILTER: The excluded versions of Unity.
|
||||
EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.2|2023.3)"
|
||||
EXCLUDE_FILTER: "(2017|2018|2023.3)"
|
||||
IGNORE_ALPHA: false
|
||||
IGNORE_BETA: false
|
||||
PROJECT_PATH: .
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
unityVersions:
|
||||
description: 'Specify the Unity versions to test. (eg. [ "2019.4.41f2", "2020.3.15f2" ])'
|
||||
required: false
|
||||
default: '[ "2019.4.41f2", "2020.3.15f2" ]'
|
||||
usePeriodVersions:
|
||||
description: "Use the period versions (.0f1, .10f1, 20f1, ...)."
|
||||
description: 'Use the period versions (.0f1, .10f1, 20f1, ...).'
|
||||
required: false
|
||||
default: "true"
|
||||
overrideFindOptions:
|
||||
description: 'Specify options for unity-changeset. (eg. --ignore-alpha --max 2020.3 )'
|
||||
required: false
|
||||
default: '--min 2019.4 --max 9999.9 --ignore-alpha --ignore-beta'
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
@@ -27,7 +38,7 @@ on:
|
||||
- "!*"
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
pull_request_target:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
@@ -39,16 +50,48 @@ jobs:
|
||||
setup:
|
||||
name: ⚙️ Setup
|
||||
runs-on: ubuntu-latest
|
||||
permissions: {} # No permissions needed for setup job
|
||||
outputs:
|
||||
unityVersions: ${{ steps.setup.outputs.unityVersions }}
|
||||
steps:
|
||||
- name: 🔑 Secrets check
|
||||
run: |
|
||||
echo "Checking secrets for ${{ github.actor }} ..."
|
||||
if [ -z "$UNITY_EMAIL" ] || [ -z "$UNITY_PASSWORD" ] || [ -z "$UNITY_LICENSE" ]; then
|
||||
echo "Error: UNITY_EMAIL, UNITY_PASSWORD, and UNITY_LICENSE secrets must be set." | tee -a $GITHUB_STEP_SUMMARY >&2
|
||||
echo "Error: See https://game.ci/docs/github/test-runner#basic-setup" | tee -a $GITHUB_STEP_SUMMARY >&2
|
||||
echo "Error: Set the secrets at ${{ github.server_url }}/${{ github.repository }}/settings/secrets/actions" | tee -a $GITHUB_STEP_SUMMARY >&2
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
- name: ⚙️ Find target Unity versions
|
||||
id: setup
|
||||
run: |
|
||||
echo "==== Target Unity Versions ===="
|
||||
LATEST_VERSIONS=`npx unity-changeset list --versions --latest-patch --min ${MINIMUM_VERSION} --json --all`
|
||||
|
||||
# Check if specific Unity versions are provided via inputs (for workflow_dispatch)
|
||||
if [ -n "${{ inputs.unityVersions }}" ]; then
|
||||
echo "* Using specified Unity versions" | tee $GITHUB_OUTPUT
|
||||
echo 'unityVersions=${{ inputs.unityVersions }}' | tee $GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Formulate find options based on inputs and environment variables
|
||||
FIND_OPTIONS=""
|
||||
[ "${{ env.IGNORE_ALPHA }}" = "true" ] && FIND_OPTIONS+=" --ignore-alpha"
|
||||
[ "${{ env.IGNORE_BETA }}" = "true" ] && FIND_OPTIONS+=" --ignore-beta"
|
||||
[ -n "${{ env.MINIMUM_VERSION }}" ] && FIND_OPTIONS+=" --min ${MINIMUM_VERSION}"
|
||||
[ -n "${{ env.MAXIMUM_VERSION }}" ] && FIND_OPTIONS+=" --max ${MAXIMUM_VERSION}"
|
||||
[ -n "${{ inputs.overrideFindOptions }}" ] && FIND_OPTIONS="${inputs.overrideFindOptions}"
|
||||
echo "find options: $FIND_OPTIONS"
|
||||
|
||||
# Find the latest Unity versions if no specific versions are provided
|
||||
LATEST_VERSIONS=`npx -y unity-changeset@latest list --json --versions --all --latest-patch $FIND_OPTIONS`
|
||||
if [ "${{ inputs.usePeriodVersions }}" = "true" ]; then
|
||||
ADDITIONAL_VERSIONS=`npx unity-changeset list --versions --grep '0f' --min ${MINIMUM_VERSION} --json`
|
||||
ADDITIONAL_VERSIONS=`npx -y unity-changeset@latest list --json --versions $FIND_OPTIONS --grep '0f'`
|
||||
else
|
||||
ADDITIONAL_VERSIONS=[]
|
||||
fi
|
||||
@@ -66,40 +109,24 @@ jobs:
|
||||
needs: setup
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 6
|
||||
max-parallel: 8
|
||||
matrix:
|
||||
unityVersion: ${{ fromJson(needs.setup.outputs.unityVersions) }}
|
||||
steps:
|
||||
- name: 🚚 Checkout ($${{ github.ref }})
|
||||
if: github.event_name == 'push'
|
||||
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 rebase ${{ github.event.pull_request.base.sha }}
|
||||
git log --oneline -n 10
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: 📥 Cache library
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
|
||||
path: ${{ env.PROJECT_PATH }}/Library
|
||||
key: ${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
|
||||
restore-keys: |
|
||||
Library-${{ matrix.unityVersion }}-
|
||||
Library-
|
||||
${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-
|
||||
${{ env.PROJECT_PATH }}-Library-
|
||||
|
||||
- name: 🛠️ Build Unity Project (Test)
|
||||
uses: game-ci/unity-builder@v4
|
||||
uses: mob-sakai/unity-builder@fix/support-unity6.6
|
||||
timeout-minutes: 45
|
||||
with:
|
||||
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
@@ -113,7 +140,7 @@ jobs:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
|
||||
- name: 🧪 Run tests
|
||||
uses: game-ci/unity-test-runner@v4
|
||||
uses: mob-sakai/unity-test-runner@fix/support-unity6.6
|
||||
timeout-minutes: 45
|
||||
with:
|
||||
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
|
||||
+2
-1
@@ -26,4 +26,5 @@ bin/
|
||||
UserSettings/
|
||||
*.app/
|
||||
Build/
|
||||
Assets/TextMeshPro Support*
|
||||
Assets/Samples*
|
||||
Packages/src/Samples~/*.meta
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69f569585a2b5439b830cc115efdf867
|
||||
guid: 809b2c417b0714d479b9ccf131d24bda
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -0,0 +1,106 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 468a46d0ae32c3544b7d98094e6448a9, type: 3}
|
||||
m_Name: AddressableAssetSettings
|
||||
m_EditorClassIdentifier:
|
||||
m_DefaultGroup: 78c1e50bdf28744fc9af8aedb47f2517
|
||||
m_OptimizeCatalogSize: 0
|
||||
m_BuildRemoteCatalog: 0
|
||||
m_BundleLocalCatalog: 0
|
||||
m_CatalogRequestsTimeout: 0
|
||||
m_DisableCatalogUpdateOnStart: 0
|
||||
m_IgnoreUnsupportedFilesInBuild: 0
|
||||
m_UniqueBundleIds: 0
|
||||
m_NonRecursiveBuilding: 0
|
||||
m_CCDEnabled: 0
|
||||
m_maxConcurrentWebRequests: 3
|
||||
m_ContiguousBundles: 0
|
||||
m_StripUnityVersionFromBundleBuild: 0
|
||||
m_DisableVisibleSubAssetRepresentations: 0
|
||||
m_ShaderBundleNaming: 0
|
||||
m_ShaderBundleCustomNaming:
|
||||
m_MonoScriptBundleNaming: 0
|
||||
m_CheckForContentUpdateRestrictionsOption: 0
|
||||
m_MonoScriptBundleCustomNaming:
|
||||
m_RemoteCatalogBuildPath:
|
||||
m_Id: e92f87e9fe51b4b0b8a9a47cf7cab399
|
||||
m_RemoteCatalogLoadPath:
|
||||
m_Id: f077767d1bbbf451db919d7819556f80
|
||||
m_ContentStateBuildPathProfileVariableName: <default settings path>
|
||||
m_CustomContentStateBuildPath:
|
||||
m_ContentStateBuildPath:
|
||||
m_BuildAddressablesWithPlayerBuild: 0
|
||||
m_overridePlayerVersion: '[UnityEditor.PlayerSettings.bundleVersion]'
|
||||
m_GroupAssets:
|
||||
- {fileID: 11400000, guid: d990055319c2b44b0b81ce4e3045db49, type: 2}
|
||||
- {fileID: 11400000, guid: cb582cfe3736847f09b83adf8d15c36a, type: 2}
|
||||
m_BuildSettings:
|
||||
m_CompileScriptsInVirtualMode: 0
|
||||
m_CleanupStreamingAssetsAfterBuilds: 1
|
||||
m_LogResourceManagerExceptions: 1
|
||||
m_BundleBuildPath: Temp/com.unity.addressables/AssetBundles
|
||||
m_ProfileSettings:
|
||||
m_Profiles:
|
||||
- m_InheritedParent:
|
||||
m_Id: f0c1919924e394e59af6bca6c9c911f0
|
||||
m_ProfileName: Default
|
||||
m_Values:
|
||||
- m_Id: 45c7a530ddf2f4d138f32bf67335f91b
|
||||
m_Value: '{UnityEngine.AddressableAssets.Addressables.RuntimePath}/[BuildTarget]'
|
||||
- m_Id: c903326cd5c18420c8e3c894b1648d26
|
||||
m_Value: '[UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]'
|
||||
- m_Id: d01b18903c32d4541ac46fd27aeee619
|
||||
m_Value: '[UnityEditor.EditorUserBuildSettings.activeBuildTarget]'
|
||||
- m_Id: e92f87e9fe51b4b0b8a9a47cf7cab399
|
||||
m_Value: ServerData/[BuildTarget]
|
||||
- m_Id: f077767d1bbbf451db919d7819556f80
|
||||
m_Value: http://[PrivateIpAddress]:[HostingServicePort]
|
||||
m_ProfileEntryNames:
|
||||
- m_Id: 45c7a530ddf2f4d138f32bf67335f91b
|
||||
m_Name: Local.LoadPath
|
||||
m_InlineUsage: 0
|
||||
- m_Id: c903326cd5c18420c8e3c894b1648d26
|
||||
m_Name: Local.BuildPath
|
||||
m_InlineUsage: 0
|
||||
- m_Id: d01b18903c32d4541ac46fd27aeee619
|
||||
m_Name: BuildTarget
|
||||
m_InlineUsage: 0
|
||||
- m_Id: e92f87e9fe51b4b0b8a9a47cf7cab399
|
||||
m_Name: Remote.BuildPath
|
||||
m_InlineUsage: 0
|
||||
- m_Id: f077767d1bbbf451db919d7819556f80
|
||||
m_Name: Remote.LoadPath
|
||||
m_InlineUsage: 0
|
||||
m_ProfileVersion: 1
|
||||
m_LabelTable:
|
||||
m_LabelNames:
|
||||
- default
|
||||
m_SchemaTemplates: []
|
||||
m_GroupTemplateObjects:
|
||||
- {fileID: 11400000, guid: e03fdb26845f04c75b6fe9288c63a63a, type: 2}
|
||||
m_InitializationObjects: []
|
||||
m_CertificateHandlerType:
|
||||
m_AssemblyName:
|
||||
m_ClassName:
|
||||
m_ActivePlayerDataBuilderIndex: 3
|
||||
m_DataBuilders:
|
||||
- {fileID: 11400000, guid: 797c488c7f2114197a8f18811c5cd128, type: 2}
|
||||
- {fileID: 11400000, guid: 1400420db15a741b5a71c357c678c805, type: 2}
|
||||
- {fileID: 11400000, guid: 96f4fd6856bbb4d5998503b7b5d15151, type: 2}
|
||||
- {fileID: 11400000, guid: afc7e8697497b41f2ac9064294b360eb, type: 2}
|
||||
m_ActiveProfileId: f0c1919924e394e59af6bca6c9c911f0
|
||||
m_HostingServicesManager:
|
||||
m_HostingServiceInfos: []
|
||||
m_Settings: {fileID: 11400000}
|
||||
m_NextInstanceId: 0
|
||||
m_RegisteredServiceTypeRefs: []
|
||||
m_PingTimeoutInMilliseconds: 5000
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9379b7b2236ab4c0e9f8d9f7db9936a8
|
||||
guid: 43329c4cc56ca415da37a048e434183a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebc947de92b024b329663fe914a7d168
|
||||
guid: a0cd82815cf624171bd2e59cf74c4f7d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -0,0 +1,76 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-6130888278409392347
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e5d17a21594effb4e9591490b009e7aa, type: 3}
|
||||
m_Name: BundledAssetGroupSchema
|
||||
m_EditorClassIdentifier:
|
||||
m_Group: {fileID: 0}
|
||||
m_InternalBundleIdMode: 1
|
||||
m_Compression: 1
|
||||
m_IncludeAddressInCatalog: 1
|
||||
m_IncludeGUIDInCatalog: 1
|
||||
m_IncludeLabelsInCatalog: 1
|
||||
m_InternalIdNamingMode: 0
|
||||
m_CacheClearBehavior: 0
|
||||
m_IncludeInBuild: 1
|
||||
m_BundledAssetProviderType:
|
||||
m_AssemblyName:
|
||||
m_ClassName:
|
||||
m_ForceUniqueProvider: 0
|
||||
m_UseAssetBundleCache: 1
|
||||
m_UseAssetBundleCrc: 1
|
||||
m_UseAssetBundleCrcForCachedBundles: 1
|
||||
m_UseUWRForLocalBundles: 0
|
||||
m_Timeout: 0
|
||||
m_ChunkedTransfer: 0
|
||||
m_RedirectLimit: -1
|
||||
m_RetryCount: 0
|
||||
m_BuildPath:
|
||||
m_Id:
|
||||
m_LoadPath:
|
||||
m_Id:
|
||||
m_BundleMode: 0
|
||||
m_AssetBundleProviderType:
|
||||
m_AssemblyName:
|
||||
m_ClassName:
|
||||
m_BundleNaming: 0
|
||||
m_AssetLoadMode: 0
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1a3c5d64ac83548c09dd1678b9f6f1cd, type: 3}
|
||||
m_Name: Packed Assets
|
||||
m_EditorClassIdentifier:
|
||||
m_SchemaObjects:
|
||||
- {fileID: -6130888278409392347}
|
||||
- {fileID: 5814898001239217010}
|
||||
m_Description: Pack assets into asset bundles.
|
||||
m_Settings: {fileID: 11400000, guid: 43329c4cc56ca415da37a048e434183a, type: 2}
|
||||
--- !u!114 &5814898001239217010
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5834b5087d578d24c926ce20cd31e6d6, type: 3}
|
||||
m_Name: ContentUpdateGroupSchema
|
||||
m_EditorClassIdentifier:
|
||||
m_Group: {fileID: 0}
|
||||
m_StaticContent: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e03fdb26845f04c75b6fe9288c63a63a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1b972071582443e2845278a859a1533
|
||||
guid: 022ed075843094601944a986a7c4ea61
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -0,0 +1,34 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
|
||||
m_Name: Built In Data
|
||||
m_EditorClassIdentifier:
|
||||
m_GroupName: Built In Data
|
||||
m_Data:
|
||||
m_SerializedData: []
|
||||
m_GUID: 05078fdb0a88640219afbdb7f385d64e
|
||||
m_SerializeEntries:
|
||||
- m_GUID: EditorSceneList
|
||||
m_Address: EditorSceneList
|
||||
m_ReadOnly: 1
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: Resources
|
||||
m_Address: Resources
|
||||
m_ReadOnly: 1
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
m_ReadOnly: 1
|
||||
m_Settings: {fileID: 11400000, guid: 43329c4cc56ca415da37a048e434183a, type: 2}
|
||||
m_SchemaSet:
|
||||
m_Schemas:
|
||||
- {fileID: 11400000, guid: b05efeaac5be043d1b4b6fd1077db150, type: 2}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d990055319c2b44b0b81ce4e3045db49
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
|
||||
m_Name: Default Local Group
|
||||
m_EditorClassIdentifier:
|
||||
m_GroupName: Default Local Group
|
||||
m_Data:
|
||||
m_SerializedData: []
|
||||
m_GUID: 78c1e50bdf28744fc9af8aedb47f2517
|
||||
m_SerializeEntries:
|
||||
- m_GUID: d9f8e387c42cf4a6785eb5cf2a94beae
|
||||
m_Address: Assets/ProjectSettings/UIEffectProjectSettings.asset
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels: []
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
m_ReadOnly: 0
|
||||
m_Settings: {fileID: 11400000, guid: 43329c4cc56ca415da37a048e434183a, type: 2}
|
||||
m_SchemaSet:
|
||||
m_Schemas:
|
||||
- {fileID: 11400000, guid: 1357ca7896c984ca2bec3ee274fc2b16, type: 2}
|
||||
- {fileID: 11400000, guid: 2796025dd70994899bc32992cf7024c9, type: 2}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb582cfe3736847f09b83adf8d15c36a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f4bdfbde85c84294892ee4118bf99c8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b1487f5d688e4f94f828f879d599dbdc, type: 3}
|
||||
m_Name: Built In Data_PlayerDataGroupSchema
|
||||
m_EditorClassIdentifier:
|
||||
m_Group: {fileID: 11400000, guid: d990055319c2b44b0b81ce4e3045db49, type: 2}
|
||||
m_IncludeResourcesFolders: 1
|
||||
m_IncludeBuildSettingsScenes: 1
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b05efeaac5be043d1b4b6fd1077db150
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e5d17a21594effb4e9591490b009e7aa, type: 3}
|
||||
m_Name: Default Local Group_BundledAssetGroupSchema
|
||||
m_EditorClassIdentifier:
|
||||
m_Group: {fileID: 11400000, guid: cb582cfe3736847f09b83adf8d15c36a, type: 2}
|
||||
m_InternalBundleIdMode: 1
|
||||
m_Compression: 1
|
||||
m_IncludeAddressInCatalog: 1
|
||||
m_IncludeGUIDInCatalog: 1
|
||||
m_IncludeLabelsInCatalog: 1
|
||||
m_InternalIdNamingMode: 0
|
||||
m_CacheClearBehavior: 0
|
||||
m_IncludeInBuild: 1
|
||||
m_BundledAssetProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider
|
||||
m_ForceUniqueProvider: 0
|
||||
m_UseAssetBundleCache: 1
|
||||
m_UseAssetBundleCrc: 1
|
||||
m_UseAssetBundleCrcForCachedBundles: 1
|
||||
m_UseUWRForLocalBundles: 0
|
||||
m_Timeout: 0
|
||||
m_ChunkedTransfer: 0
|
||||
m_RedirectLimit: -1
|
||||
m_RetryCount: 0
|
||||
m_BuildPath:
|
||||
m_Id: c903326cd5c18420c8e3c894b1648d26
|
||||
m_LoadPath:
|
||||
m_Id: 45c7a530ddf2f4d138f32bf67335f91b
|
||||
m_BundleMode: 0
|
||||
m_AssetBundleProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider
|
||||
m_BundleNaming: 0
|
||||
m_AssetLoadMode: 0
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1357ca7896c984ca2bec3ee274fc2b16
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5834b5087d578d24c926ce20cd31e6d6, type: 3}
|
||||
m_Name: Default Local Group_ContentUpdateGroupSchema
|
||||
m_EditorClassIdentifier:
|
||||
m_Group: {fileID: 11400000, guid: cb582cfe3736847f09b83adf8d15c36a, type: 2}
|
||||
m_StaticContent: 0
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2796025dd70994899bc32992cf7024c9
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c26ed2464c14469b95f5e97b5f2428c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 88d21199f5d473f4db36845f2318f180, type: 3}
|
||||
m_Name: BuildScriptFastMode
|
||||
m_EditorClassIdentifier:
|
||||
instanceProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider
|
||||
sceneProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 797c488c7f2114197a8f18811c5cd128
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3e2e0ffa088c91d41a086d0b8cb16bdc, type: 3}
|
||||
m_Name: BuildScriptPackedMode
|
||||
m_EditorClassIdentifier:
|
||||
instanceProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider
|
||||
sceneProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afc7e8697497b41f2ac9064294b360eb
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ad8c280d42ee0ed41a27db23b43dd2bf, type: 3}
|
||||
m_Name: BuildScriptPackedPlayMode
|
||||
m_EditorClassIdentifier:
|
||||
instanceProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider
|
||||
sceneProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96f4fd6856bbb4d5998503b7b5d15151
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bb0e4994b34add1409fd8ccaf4a82de5, type: 3}
|
||||
m_Name: BuildScriptVirtualMode
|
||||
m_EditorClassIdentifier:
|
||||
instanceProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider
|
||||
sceneProviderType:
|
||||
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1400420db15a741b5a71c357c678c805
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,15 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3a189bb168d8d90478a09ea08c2f3d72, type: 3}
|
||||
m_Name: DefaultObject
|
||||
m_EditorClassIdentifier:
|
||||
m_AddressableAssetSettingsGuid: 43329c4cc56ca415da37a048e434183a
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c73d220faf28240f1a28d59807c79b75
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d68f022c46564bf6ac355588397507a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96c707d74b3d841a5a3015029fa74330
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,34 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7e3976da977cb49238499ea3b4c237ae, type: 3}
|
||||
m_Name: ProfileDataSourceSettings
|
||||
m_EditorClassIdentifier:
|
||||
profileGroupTypes:
|
||||
- m_GroupTypePrefix: Built-In
|
||||
m_Variables:
|
||||
- m_Suffix: BuildPath
|
||||
m_Value: '[UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]'
|
||||
- m_Suffix: LoadPath
|
||||
m_Value: '{UnityEngine.AddressableAssets.Addressables.RuntimePath}/[BuildTarget]'
|
||||
- m_GroupTypePrefix: Editor Hosted
|
||||
m_Variables:
|
||||
- m_Suffix: BuildPath
|
||||
m_Value: ServerData/[BuildTarget]
|
||||
- m_Suffix: LoadPath
|
||||
m_Value: http://[PrivateIpAddress]:[HostingServicePort]
|
||||
environments: []
|
||||
currentEnvironment:
|
||||
id:
|
||||
projectId:
|
||||
projectGenesisId:
|
||||
name:
|
||||
isDefault: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ecf31fe7c4aa4565ad61fab272f22b8
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 481f0900af5824be89c275390a9fa0b4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,104 @@
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class HotUpdate : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private string m_Address;
|
||||
|
||||
[SerializeField]
|
||||
private Text m_Log;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_ExecuteOnStart;
|
||||
|
||||
private readonly StringBuilder _sb = new StringBuilder(1024);
|
||||
|
||||
private Coroutine _co;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (m_ExecuteOnStart)
|
||||
{
|
||||
Execute();
|
||||
}
|
||||
}
|
||||
|
||||
private void AddLog(string message)
|
||||
{
|
||||
Debug.Log(message);
|
||||
_sb.AppendLine(message);
|
||||
if (m_Log)
|
||||
{
|
||||
m_Log.text = _sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
if (string.IsNullOrEmpty(m_Address))
|
||||
{
|
||||
AddLog($"*** Address is empty. Please set the address of the asset to load.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_co != null)
|
||||
{
|
||||
AddLog($"*** Execution is already in progress. Please wait until it completes.");
|
||||
return;
|
||||
}
|
||||
|
||||
_co = StartCoroutine(Co_Execute());
|
||||
}
|
||||
|
||||
public void LoadNextScene()
|
||||
{
|
||||
SceneManager.LoadScene(gameObject.scene.buildIndex + 1, LoadSceneMode.Single);
|
||||
}
|
||||
|
||||
private IEnumerator Co_Execute()
|
||||
{
|
||||
AddLog($"########################################");
|
||||
AddLog($"Hot update starting...");
|
||||
AddLog($"########################################");
|
||||
AddLog("");
|
||||
|
||||
AddLog($"Loading '{m_Address}'...");
|
||||
var handle = Addressables.LoadAssetAsync<Object>(m_Address);
|
||||
|
||||
while (handle.IsDone == false)
|
||||
{
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
AddLog($" Progress: {handle.PercentComplete:P}");
|
||||
}
|
||||
|
||||
if (handle.Status == AsyncOperationStatus.Succeeded)
|
||||
{
|
||||
AddLog($" Loaded '{m_Address}' successfully.");
|
||||
}
|
||||
else
|
||||
{
|
||||
AddLog($" *** Failed to load '{m_Address}'.");
|
||||
AddLog($" *** {handle.OperationException.Message}");
|
||||
yield break;
|
||||
}
|
||||
|
||||
AddLog("");
|
||||
AddLog($"Hot-Update complete !");
|
||||
AddLog("");
|
||||
|
||||
AddLog($" -> Load next scene in: 3");
|
||||
yield return new WaitForSeconds(1f);
|
||||
AddLog($" -> Load next scene in: 2");
|
||||
yield return new WaitForSeconds(1f);
|
||||
AddLog($" -> Load next scene in: 1");
|
||||
yield return new WaitForSeconds(1f);
|
||||
|
||||
LoadNextScene();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: deea59e7cd34449c89e7c1f6438a5392
|
||||
guid: 0fd13d911290d4262ad39fa2c45e030c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ec916ecedc5e41a1896062381cbd257
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,286 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!28 &-6111546302731763495
|
||||
Texture2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: NotoSansJP-Regular Atlas
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_ForcedFallbackFormat: 4
|
||||
m_DownscaleFallback: 0
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 2
|
||||
m_Width: 0
|
||||
m_Height: 0
|
||||
m_CompleteImageSize: 0
|
||||
m_MipsStripped: 0
|
||||
m_TextureFormat: 1
|
||||
m_MipCount: 1
|
||||
m_IsReadable: 1
|
||||
m_IsPreProcessed: 0
|
||||
m_IgnoreMasterTextureLimit: 0
|
||||
m_StreamingMipmaps: 0
|
||||
m_StreamingMipmapsPriority: 0
|
||||
m_VTOnly: 0
|
||||
m_AlphaIsTransparency: 0
|
||||
m_ImageCount: 1
|
||||
m_TextureDimension: 2
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 1
|
||||
m_MipBias: 0
|
||||
m_WrapU: 0
|
||||
m_WrapV: 0
|
||||
m_WrapW: 0
|
||||
m_LightmapFormat: 0
|
||||
m_ColorSpace: 0
|
||||
m_PlatformBlob:
|
||||
image data: 0
|
||||
_typelessdata:
|
||||
m_StreamData:
|
||||
serializedVersion: 2
|
||||
offset: 0
|
||||
size: 0
|
||||
path:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 71c1514a6bd24e1e882cebbe1904ce04, type: 3}
|
||||
m_Name: NotoSansJP-Regular SDF - Dynamic
|
||||
m_EditorClassIdentifier:
|
||||
hashCode: -1410962959
|
||||
material: {fileID: 444162133241932390}
|
||||
materialHashCode: -1336267599
|
||||
m_Version: 1.1.0
|
||||
m_SourceFontFileGUID: 3b86b3f5141924393b3a212d6a5ec9e0
|
||||
m_SourceFontFile_EditorRef: {fileID: 12800000, guid: 3b86b3f5141924393b3a212d6a5ec9e0,
|
||||
type: 3}
|
||||
m_SourceFontFile: {fileID: 12800000, guid: 3b86b3f5141924393b3a212d6a5ec9e0, type: 3}
|
||||
m_AtlasPopulationMode: 1
|
||||
m_FaceInfo:
|
||||
m_FaceIndex: 0
|
||||
m_FamilyName: Noto Sans JP
|
||||
m_StyleName: Regular
|
||||
m_PointSize: 24
|
||||
m_Scale: 1
|
||||
m_LineHeight: 34.752
|
||||
m_AscentLine: 27.839998
|
||||
m_CapLine: 18
|
||||
m_MeanLine: 14
|
||||
m_Baseline: 0
|
||||
m_DescentLine: -6.9119997
|
||||
m_SuperscriptOffset: 27.839998
|
||||
m_SuperscriptSize: 0.5
|
||||
m_SubscriptOffset: -6.9119997
|
||||
m_SubscriptSize: 0.5
|
||||
m_UnderlineOffset: -3.6
|
||||
m_UnderlineThickness: 1.1999999
|
||||
m_StrikethroughOffset: 5.6
|
||||
m_StrikethroughThickness: 1.1999999
|
||||
m_TabWidth: 5
|
||||
m_GlyphTable: []
|
||||
m_CharacterTable: []
|
||||
m_AtlasTextures:
|
||||
- {fileID: -6111546302731763495}
|
||||
m_AtlasTextureIndex: 0
|
||||
m_IsMultiAtlasTexturesEnabled: 0
|
||||
m_ClearDynamicDataOnBuild: 1
|
||||
m_UsedGlyphRects: []
|
||||
m_FreeGlyphRects:
|
||||
- m_X: 0
|
||||
m_Y: 0
|
||||
m_Width: 1023
|
||||
m_Height: 1023
|
||||
m_fontInfo:
|
||||
Name:
|
||||
PointSize: 0
|
||||
Scale: 0
|
||||
CharacterCount: 0
|
||||
LineHeight: 0
|
||||
Baseline: 0
|
||||
Ascender: 0
|
||||
CapHeight: 0
|
||||
Descender: 0
|
||||
CenterLine: 0
|
||||
SuperscriptOffset: 0
|
||||
SubscriptOffset: 0
|
||||
SubSize: 0
|
||||
Underline: 0
|
||||
UnderlineThickness: 0
|
||||
strikethrough: 0
|
||||
strikethroughThickness: 0
|
||||
TabWidth: 0
|
||||
Padding: 0
|
||||
AtlasWidth: 0
|
||||
AtlasHeight: 0
|
||||
atlas: {fileID: 0}
|
||||
m_AtlasWidth: 1024
|
||||
m_AtlasHeight: 1024
|
||||
m_AtlasPadding: 9
|
||||
m_AtlasRenderMode: 4165
|
||||
m_glyphInfoList: []
|
||||
m_KerningTable:
|
||||
kerningPairs: []
|
||||
m_FontFeatureTable:
|
||||
m_GlyphPairAdjustmentRecords: []
|
||||
fallbackFontAssets: []
|
||||
m_FallbackFontAssetTable: []
|
||||
m_CreationSettings:
|
||||
sourceFontFileName:
|
||||
sourceFontFileGUID: 3b86b3f5141924393b3a212d6a5ec9e0
|
||||
pointSizeSamplingMode: 0
|
||||
pointSize: 24
|
||||
padding: 9
|
||||
packingMode: 0
|
||||
atlasWidth: 1024
|
||||
atlasHeight: 1024
|
||||
characterSetSelectionMode: 7
|
||||
characterSequence:
|
||||
referencedFontAssetGUID:
|
||||
referencedTextAssetGUID:
|
||||
fontStyle: 0
|
||||
fontStyleModifier: 0
|
||||
renderMode: 4165
|
||||
includeFontFeatures: 0
|
||||
m_FontWeightTable:
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
- regularTypeface: {fileID: 0}
|
||||
italicTypeface: {fileID: 0}
|
||||
fontWeights: []
|
||||
normalStyle: 0
|
||||
normalSpacingOffset: 0
|
||||
boldStyle: 0.75
|
||||
boldSpacing: 7
|
||||
italicStyle: 35
|
||||
tabSize: 10
|
||||
--- !u!21 &444162133241932390
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: NotoSansJP-Regular Atlas Material
|
||||
m_Shader: {fileID: 4800000, guid: 68e6db2ebdc24f95958faec2be5558d6, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _Cube:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _FaceTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: -6111546302731763495}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OutlineTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _Ambient: 0.5
|
||||
- _Bevel: 0.5
|
||||
- _BevelClamp: 0
|
||||
- _BevelOffset: 0
|
||||
- _BevelRoundness: 0
|
||||
- _BevelWidth: 0
|
||||
- _BumpFace: 0
|
||||
- _BumpOutline: 0
|
||||
- _ColorMask: 15
|
||||
- _CullMode: 0
|
||||
- _Diffuse: 0.5
|
||||
- _FaceDilate: 0
|
||||
- _FaceUVSpeedX: 0
|
||||
- _FaceUVSpeedY: 0
|
||||
- _GlowInner: 0.05
|
||||
- _GlowOffset: 0
|
||||
- _GlowOuter: 0.05
|
||||
- _GlowPower: 0.75
|
||||
- _GradientScale: 10
|
||||
- _LightAngle: 3.1416
|
||||
- _MaskSoftnessX: 0
|
||||
- _MaskSoftnessY: 0
|
||||
- _OutlineSoftness: 0
|
||||
- _OutlineUVSpeedX: 0
|
||||
- _OutlineUVSpeedY: 0
|
||||
- _OutlineWidth: 0
|
||||
- _PerspectiveFilter: 0.875
|
||||
- _Reflectivity: 10
|
||||
- _ScaleRatioA: 1
|
||||
- _ScaleRatioB: 1
|
||||
- _ScaleRatioC: 1
|
||||
- _ScaleX: 1
|
||||
- _ScaleY: 1
|
||||
- _ShaderFlags: 0
|
||||
- _Sharpness: 0
|
||||
- _SpecularPower: 2
|
||||
- _Stencil: 0
|
||||
- _StencilComp: 8
|
||||
- _StencilOp: 0
|
||||
- _StencilReadMask: 255
|
||||
- _StencilWriteMask: 255
|
||||
- _TextureHeight: 1024
|
||||
- _TextureWidth: 1024
|
||||
- _UnderlayDilate: 0
|
||||
- _UnderlayOffsetX: 0
|
||||
- _UnderlayOffsetY: 0
|
||||
- _UnderlaySoftness: 0
|
||||
- _VertexOffsetX: 0
|
||||
- _VertexOffsetY: 0
|
||||
- _WeightBold: 0.75
|
||||
- _WeightNormal: 0
|
||||
m_Colors:
|
||||
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
|
||||
- _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _GlowColor: {r: 0, g: 1, b: 0, a: 0.5}
|
||||
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
|
||||
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c1191089341846fcb754b6aab3dd435
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52ffdb2a86f414090abb93192f599f6f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b86b3f5141924393b3a212d6a5ec9e0
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
fontSize: 16
|
||||
forceTextureCase: -2
|
||||
characterSpacing: 0
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontNames:
|
||||
- Noto Sans JP
|
||||
fallbackFontReferences: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
||||
useLegacyBoundsCalculation: 0
|
||||
shouldRoundAdvanceValue: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 064c6ea9a4d6f4cc1938d0878e91e3d6
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -43,6 +43,46 @@ ShaderVariantCollection:
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TRANSITION_SHINY UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TONE_RETRO UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER GLOW_ON UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: GLOW_ON SAMPLING_BLUR_DETAIL UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: GLOW_ON SAMPLING_PIXELATION UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: SAMPLING_PIXELATION TONE_RETRO
|
||||
passType: 0
|
||||
- keywords: GLOW_ON SAMPLING_RGB_SHIFT UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: GLOW_ON SAMPLING_EDGE_LUMINANCE UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: TRANSITION_DISSOLVE
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TRANSITION_DISSOLVE UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: TRANSITION_SHINY
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TRANSITION_SHINY UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: TRANSITION_MELT
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TRANSITION_MELT UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: TRANSITION_BURN
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TRANSITION_BURN UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER GLOW_ON TRANSITION_BURN UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: TRANSITION_PATTERN
|
||||
passType: 0
|
||||
- keywords: GLOW_ON TRANSITION_PATTERN UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: EDGE_PLAIN GLOW_ON UNDERLAY_ON
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER GLOW_ON GRADATION_GRADIENT UNDERLAY_ON
|
||||
passType: 0
|
||||
- first: {fileID: 4800000, guid: 96246b1ead49a4c5a996fd477bc5a117, type: 3}
|
||||
second:
|
||||
variants:
|
||||
@@ -160,6 +200,114 @@ ShaderVariantCollection:
|
||||
passType: 0
|
||||
- keywords: TRANSITION_SHINY UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: TONE_GRAYSCALE
|
||||
passType: 0
|
||||
- keywords: TONE_SEPIA
|
||||
passType: 0
|
||||
- keywords: TONE_NEGATIVE
|
||||
passType: 0
|
||||
- keywords: TONE_RETRO
|
||||
passType: 0
|
||||
- keywords: TONE_POSTERIZE
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER
|
||||
passType: 0
|
||||
- keywords: SAMPLING_BLUR_FAST
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER SAMPLING_BLUR_FAST
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER SAMPLING_BLUR_FAST UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER SAMPLING_BLUR_FAST TONE_GRAYSCALE
|
||||
passType: 0
|
||||
- keywords: SAMPLING_BLUR_MEDIUM
|
||||
passType: 0
|
||||
- keywords: SAMPLING_BLUR_DETAIL
|
||||
passType: 0
|
||||
- keywords: SAMPLING_PIXELATION
|
||||
passType: 0
|
||||
- keywords: SAMPLING_PIXELATION TONE_RETRO
|
||||
passType: 0
|
||||
- keywords: SAMPLING_PIXELATION TONE_RETRO UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: SAMPLING_RGB_SHIFT
|
||||
passType: 0
|
||||
- keywords: SAMPLING_EDGE_LUMINANCE
|
||||
passType: 0
|
||||
- keywords: SAMPLING_EDGE_ALPHA
|
||||
passType: 0
|
||||
- keywords: TRANSITION_FADE
|
||||
passType: 0
|
||||
- keywords: TRANSITION_CUTOFF
|
||||
passType: 0
|
||||
- keywords: TRANSITION_DISSOLVE
|
||||
passType: 0
|
||||
- keywords: TRANSITION_DISSOLVE UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER SAMPLING_BLUR_FAST TONE_GRAYSCALE TRANSITION_DISSOLVE
|
||||
passType: 0
|
||||
- keywords: TRANSITION_SHINY
|
||||
passType: 0
|
||||
- keywords: TRANSITION_SHINY UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: TRANSITION_MASK
|
||||
passType: 0
|
||||
- keywords: SAMPLING_EDGE_LUMINANCE TRANSITION_MASK
|
||||
passType: 0
|
||||
- keywords: TRANSITION_MELT
|
||||
passType: 0
|
||||
- keywords: TRANSITION_MELT UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER TRANSITION_MELT
|
||||
passType: 0
|
||||
- keywords: TRANSITION_BURN
|
||||
passType: 0
|
||||
- keywords: TRANSITION_BURN UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: TRANSITION_PATTERN
|
||||
passType: 0
|
||||
- keywords: TRANSITION_PATTERN UNITY_UI_CLIP_RECT
|
||||
passType: 0
|
||||
- keywords: TRANSITION_BLAZE
|
||||
passType: 0
|
||||
- keywords: EDGE_PLAIN
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER EDGE_PLAIN
|
||||
passType: 0
|
||||
- keywords: EDGE_PLAIN TRANSITION_PATTERN
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER EDGE_PLAIN TRANSITION_PATTERN
|
||||
passType: 0
|
||||
- keywords: EDGE_SHINY
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER EDGE_SHINY
|
||||
passType: 0
|
||||
- keywords: EDGE_SHINY SAMPLING_EDGE_ALPHA
|
||||
passType: 0
|
||||
- keywords: EDGE_SHINY TRANSITION_PATTERN
|
||||
passType: 0
|
||||
- keywords: DETAIL_MASKING
|
||||
passType: 0
|
||||
- keywords: DETAIL_MULTIPLY
|
||||
passType: 0
|
||||
- keywords: DETAIL_ADDITIVE
|
||||
passType: 0
|
||||
- keywords: DETAIL_SUBTRACTIVE
|
||||
passType: 0
|
||||
- keywords: DETAIL_REPLACE
|
||||
passType: 0
|
||||
- keywords: DETAIL_MULTIPLY_ADDITIVE
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER TARGET_HUE
|
||||
passType: 0
|
||||
- keywords: COLOR_FILTER TARGET_LUMINANCE
|
||||
passType: 0
|
||||
- keywords: GRADATION_GRADIENT
|
||||
passType: 0
|
||||
- keywords: GRADATION_COLOR2
|
||||
passType: 0
|
||||
- keywords: GRADATION_COLOR4
|
||||
passType: 0
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -172,6 +320,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 7d43f626d9b5f4d729097092ded48bdb, type: 3}
|
||||
m_Name: UIEffectProjectSettings
|
||||
m_EditorClassIdentifier:
|
||||
m_PreLoadSettingsInBuild: 0
|
||||
m_RuntimePresets: []
|
||||
m_RuntimePresetsV2:
|
||||
- {fileID: 11400000, guid: 460881a8263ce454799a8c689c28d8c9, type: 2}
|
||||
@@ -199,5 +348,8 @@ MonoBehaviour:
|
||||
- key: Hidden/UI/Default (SoftMaskable)
|
||||
value: Hidden/UI/Default (UIEffect)
|
||||
m_Asset: {fileID: -8740588384831342173}
|
||||
m_RegisteredShaders:
|
||||
- {fileID: 4800000, guid: 935b7be1c88464d2eb87204fdfab5a38, type: 3}
|
||||
- {fileID: 4800000, guid: 96246b1ead49a4c5a996fd477bc5a117, type: 3}
|
||||
m_ErrorOnUnregisteredVariant: 0
|
||||
m_UnregisteredVariants: []
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../Packages/src/Samples~
|
||||
@@ -4,7 +4,8 @@
|
||||
"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.symbolic-linker": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/SymbolicLinker",
|
||||
"com.unity.ide.rider": "3.0.36",
|
||||
"com.unity.addressables": "1.22.3",
|
||||
"com.unity.ide.rider": "3.0.38",
|
||||
"com.unity.test-framework": "1.1.33",
|
||||
"com.unity.textmeshpro": "3.0.9",
|
||||
"com.unity.modules.animation": "1.0.0"
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {},
|
||||
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
|
||||
"hash": "d5d12cb14184509b0d4ab12fa22dd3e6f6b50f16"
|
||||
},
|
||||
"com.coffee.minimal-resource": {
|
||||
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/MinimalResource",
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {},
|
||||
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
|
||||
"hash": "d5d12cb14184509b0d4ab12fa22dd3e6f6b50f16"
|
||||
},
|
||||
"com.coffee.nano-monitor": {
|
||||
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
|
||||
@@ -21,14 +21,14 @@
|
||||
"dependencies": {
|
||||
"com.unity.ugui": "1.0.0"
|
||||
},
|
||||
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
|
||||
"hash": "d5d12cb14184509b0d4ab12fa22dd3e6f6b50f16"
|
||||
},
|
||||
"com.coffee.symbolic-linker": {
|
||||
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/SymbolicLinker",
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {},
|
||||
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
|
||||
"hash": "d5d12cb14184509b0d4ab12fa22dd3e6f6b50f16"
|
||||
},
|
||||
"com.coffee.ui-effect": {
|
||||
"version": "file:src",
|
||||
@@ -38,6 +38,20 @@
|
||||
"com.unity.ugui": "1.0.0"
|
||||
}
|
||||
},
|
||||
"com.unity.addressables": {
|
||||
"version": "1.22.3",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.modules.assetbundle": "1.0.0",
|
||||
"com.unity.modules.jsonserialize": "1.0.0",
|
||||
"com.unity.modules.imageconversion": "1.0.0",
|
||||
"com.unity.modules.unitywebrequest": "1.0.0",
|
||||
"com.unity.scriptablebuildpipeline": "1.21.25",
|
||||
"com.unity.modules.unitywebrequestassetbundle": "1.0.0"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.ext.nunit": {
|
||||
"version": "1.0.6",
|
||||
"depth": 1,
|
||||
@@ -46,7 +60,7 @@
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.ide.rider": {
|
||||
"version": "3.0.36",
|
||||
"version": "3.0.38",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
@@ -54,6 +68,13 @@
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.scriptablebuildpipeline": {
|
||||
"version": "1.21.25",
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.test-framework": {
|
||||
"version": "1.1.33",
|
||||
"depth": 0,
|
||||
@@ -89,6 +110,18 @@
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.assetbundle": {
|
||||
"version": "1.0.0",
|
||||
"depth": 1,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.imageconversion": {
|
||||
"version": "1.0.0",
|
||||
"depth": 1,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.imgui": {
|
||||
"version": "1.0.0",
|
||||
"depth": 1,
|
||||
@@ -106,6 +139,21 @@
|
||||
"depth": 2,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.unitywebrequest": {
|
||||
"version": "1.0.0",
|
||||
"depth": 1,
|
||||
"source": "builtin",
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.modules.unitywebrequestassetbundle": {
|
||||
"version": "1.0.0",
|
||||
"depth": 1,
|
||||
"source": "builtin",
|
||||
"dependencies": {
|
||||
"com.unity.modules.assetbundle": "1.0.0",
|
||||
"com.unity.modules.unitywebrequest": "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,28 @@
|
||||
"@semantic-release/commit-analyzer",
|
||||
"@semantic-release/release-notes-generator",
|
||||
"@semantic-release/changelog",
|
||||
[
|
||||
"@semantic-release/exec",
|
||||
{
|
||||
"prepareCmd": "node ./Samples~/sync-sample-package-versions.js ${nextRelease.version}"
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/npm",
|
||||
{
|
||||
"npmPublish": false
|
||||
}
|
||||
],
|
||||
"@semantic-release/git",
|
||||
[
|
||||
"@semantic-release/git",
|
||||
{
|
||||
"assets": [
|
||||
"CHANGELOG.md",
|
||||
"package.json",
|
||||
"Samples~/**/package.json"
|
||||
]
|
||||
}
|
||||
],
|
||||
"@semantic-release/github"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,216 @@
|
||||
# [5.12.0](https://github.com/mob-sakai/UIEffect/compare/5.11.10...5.12.0) (2026-11-17)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* "Additional Resource" can be installed as a package instead of importing as a sample ([afbfcdd](https://github.com/mob-sakai/UIEffect/commit/afbfcdd40c5775390643d9c649e2bc1f223148f8))
|
||||
|
||||
## [5.11.10](https://github.com/mob-sakai/UIEffect/compare/5.11.9...5.11.10) (2026-11-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* added "Show Readme" to the auto-import menu ([27629cd](https://github.com/mob-sakai/UIEffect/commit/27629cdd7c9dd64c053a92fcd69119efffe4a127))
|
||||
* fix font path in demo ([3ca1214](https://github.com/mob-sakai/UIEffect/commit/3ca121423382668eee335fbb8bf8308b7f04159b))
|
||||
* fix potential NPE in code ([6e8aaf3](https://github.com/mob-sakai/UIEffect/commit/6e8aaf36f00e4a42f7b9d6f79e065d4022b567c2))
|
||||
* fix potential NPE in code ([d41d1ad](https://github.com/mob-sakai/UIEffect/commit/d41d1ad21f3b4ce38bb1fae870cf8621ed61a1e8))
|
||||
* fix project setting inspector ([d359086](https://github.com/mob-sakai/UIEffect/commit/d359086ed4baaf2bc0bfb64742492e3ea6d6d4b6))
|
||||
|
||||
## [5.11.9](https://github.com/mob-sakai/UIEffect/compare/5.11.8...5.11.9) (2026-11-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* color filter does not reflect the correct color space. ([6cbb793](https://github.com/mob-sakai/UIEffect/commit/6cbb793d8d421a14c6c694ea08914506607171fc)), closes [#409](https://github.com/mob-sakai/UIEffect/issues/409)
|
||||
* improve tweener editor ([4a49e9a](https://github.com/mob-sakai/UIEffect/commit/4a49e9a8b22e7c77851eef6810c3106e716cbb93))
|
||||
* support Unity 6.6+ with ShaderGraph package ([e856b0b](https://github.com/mob-sakai/UIEffect/commit/e856b0b9396025c3352054e65b090421ab2e3b40))
|
||||
* tweener does not affect multi-font glyphs (TMP_SubMeshUI) ([485e2df](https://github.com/mob-sakai/UIEffect/commit/485e2df9fc305db20aa473972f4a11e219cac7be)), closes [#413](https://github.com/mob-sakai/UIEffect/issues/413)
|
||||
|
||||
## [5.11.8](https://github.com/mob-sakai/UIEffect/compare/5.11.7...5.11.8) (2026-11-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove conflicting FormerlySerializedAs on UIEffectTweener.m_PlayOnEnable ([55a7f27](https://github.com/mob-sakai/UIEffect/commit/55a7f272042e869e6659f7a2603f9a16dbb3ab65))
|
||||
|
||||
## [5.11.7](https://github.com/mob-sakai/UIEffect/compare/5.11.6...5.11.7) (2026-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ignore shader registry order changes ([014bba3](https://github.com/mob-sakai/UIEffect/commit/014bba3f5687ecfe41caa00d454f196baf7e3483)), closes [#407](https://github.com/mob-sakai/UIEffect/issues/407)
|
||||
|
||||
## [5.11.6](https://github.com/mob-sakai/UIEffect/compare/5.11.5...5.11.6) (2026-08-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* refresh material when changing shadow mode ([8bb782c](https://github.com/mob-sakai/UIEffect/commit/8bb782c90afb42d6569d8dfcfe022b007171f97e))
|
||||
|
||||
## [5.11.5](https://github.com/mob-sakai/UIEffect/compare/5.11.4...5.11.5) (2026-07-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix memory leak ([2dcb7f7](https://github.com/mob-sakai/UIEffect/commit/2dcb7f7e8678a2ffcf3832d0c5011aa1da6c3677)), closes [#405](https://github.com/mob-sakai/UIEffect/issues/405)
|
||||
|
||||
## [5.11.4](https://github.com/mob-sakai/UIEffect/compare/5.11.3...5.11.4) (2026-07-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* infinite asset import loop caused by unchanged ProjectSettings being marked dirty ([dbf8ae0](https://github.com/mob-sakai/UIEffect/commit/dbf8ae00f50470912d458fda853a34ef94d7d533)), closes [#404](https://github.com/mob-sakai/UIEffect/issues/404)
|
||||
|
||||
## [5.11.3](https://github.com/mob-sakai/UIEffect/compare/5.11.2...5.11.3) (2026-07-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* TextMeshPro support is not working ([9d98096](https://github.com/mob-sakai/UIEffect/commit/9d980961d6cf45e519ad96bf2e7260ed515f0f70)), closes [#402](https://github.com/mob-sakai/UIEffect/issues/402)
|
||||
|
||||
## [5.11.2](https://github.com/mob-sakai/UIEffect/compare/5.11.1...5.11.2) (2026-07-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add null check ([161fc54](https://github.com/mob-sakai/UIEffect/commit/161fc546cad251ad798c2fd9e9472d687aa7f2c3))
|
||||
|
||||
## [5.11.1](https://github.com/mob-sakai/UIEffect/compare/5.11.0...5.11.1) (2026-06-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* support "disable domain reload" on Unity 6.6 or later ([a556c28](https://github.com/mob-sakai/UIEffect/commit/a556c282210303d9e7a7c284bb4b41ef3a35e3e1))
|
||||
|
||||
# [5.11.0](https://github.com/mob-sakai/UIEffect/compare/5.10.9...5.11.0) (2026-06-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* enable/disable Gameobject break effect with 'TrueShadow' ([730aa2b](https://github.com/mob-sakai/UIEffect/commit/730aa2bb4d872ddab63f2dad611a063cefa07064)), closes [#400](https://github.com/mob-sakai/UIEffect/issues/400)
|
||||
* select TMP submesh by mesh before material ([f538ef2](https://github.com/mob-sakai/UIEffect/commit/f538ef2cba3d4d76f6683bccee65d5a9694dad37))
|
||||
* some fix ([b6b538f](https://github.com/mob-sakai/UIEffect/commit/b6b538f64f0b06ddfb4ad2edd6b7db6dc1d067d8))
|
||||
* Support for skipping "reload domain" ([ec3fb13](https://github.com/mob-sakai/UIEffect/commit/ec3fb13c111638781bf852e2a4a4747fbfeb7d3a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add option to remove from preloadedAssets when build player ([e955715](https://github.com/mob-sakai/UIEffect/commit/e955715c99c474881e0b27ecc325061ce0d866a0)), closes [#393](https://github.com/mob-sakai/UIEffect/issues/393)
|
||||
* support XBOX One/Series ([72bb1c5](https://github.com/mob-sakai/UIEffect/commit/72bb1c51318829e7ced3b1436892a5969aedd9a3)), closes [#385](https://github.com/mob-sakai/UIEffect/issues/385) [#394](https://github.com/mob-sakai/UIEffect/issues/394)
|
||||
|
||||
## [5.10.9](https://github.com/mob-sakai/UIEffect/compare/5.10.8...5.10.9) (2026-06-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ambiguous call to 'lerp' in shader ([cd68b36](https://github.com/mob-sakai/UIEffect/commit/cd68b364c48e979d6ef227e53a522f096e0df47a)), closes [#390](https://github.com/mob-sakai/UIEffect/issues/390)
|
||||
* Clarify that the `ShaderGraph support` is available only in Unity 2023.2/6.0 or later ([57031c3](https://github.com/mob-sakai/UIEffect/commit/57031c3e3c2d64ee76d3e568d378cd54a5e84af5)), closes [#391](https://github.com/mob-sakai/UIEffect/issues/391)
|
||||
* support Unity 6.5 or later ([2d6f7ed](https://github.com/mob-sakai/UIEffect/commit/2d6f7ed63dd83b3f90c2fa6d93a3c84afd6de866)), closes [#392](https://github.com/mob-sakai/UIEffect/issues/392) [#398](https://github.com/mob-sakai/UIEffect/issues/398)
|
||||
* UIEffect.detailColor is not working ([f3da972](https://github.com/mob-sakai/UIEffect/commit/f3da972c0cba526f7784207c2d8ab48b5dd692f3)), closes [#399](https://github.com/mob-sakai/UIEffect/issues/399)
|
||||
|
||||
## [5.10.8](https://github.com/mob-sakai/UIEffect/compare/5.10.7...5.10.8) (2026-01-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Canvas not properly cached when objects are outside Canvas ([4a4e50e](https://github.com/mob-sakai/UIEffect/commit/4a4e50e01fb50925352c73b27901024494ae933c))
|
||||
|
||||
## [5.10.7](https://github.com/mob-sakai/UIEffect/compare/5.10.6...5.10.7) (2025-12-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* support Unity 6000.4 ([7fc0c73](https://github.com/mob-sakai/UIEffect/commit/7fc0c7364d8dc39e26eac3c3b79797b139f09817))
|
||||
|
||||
## [5.10.6](https://github.com/mob-sakai/UIEffect/compare/5.10.5...5.10.6) (2025-12-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fixed an issue where shader variants were not registered automatically ([6b79864](https://github.com/mob-sakai/UIEffect/commit/6b79864a394d79e6ad13f64af1d521fab1f781a7)), closes [#383](https://github.com/mob-sakai/UIEffect/issues/383)
|
||||
|
||||
## [5.10.5](https://github.com/mob-sakai/UIEffect/compare/5.10.4...5.10.5) (2025-11-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* graphic disappears when changing filters from code ([8776057](https://github.com/mob-sakai/UIEffect/commit/87760570ec7f4e2ca395cfaa0d2ab5d28c9cf9f3)), closes [#382](https://github.com/mob-sakai/UIEffect/issues/382)
|
||||
|
||||
## [5.10.4](https://github.com/mob-sakai/UIEffect/compare/5.10.3...5.10.4) (2025-10-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove `sealed` from `UIEffect` and `UIEffectReplica` ([2fd87e9](https://github.com/mob-sakai/UIEffect/commit/2fd87e909af65bf88a9c39cd157dfb06a56b3af0)), closes [#379](https://github.com/mob-sakai/UIEffect/issues/379)
|
||||
|
||||
## [5.10.3](https://github.com/mob-sakai/UIEffect/compare/5.10.2...5.10.3) (2025-10-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* displays as black rectangle when opening editor ([4a8d341](https://github.com/mob-sakai/UIEffect/commit/4a8d341625f73d70c512f7e6f0b864be1adbf459)), closes [#376](https://github.com/mob-sakai/UIEffect/issues/376)
|
||||
|
||||
## [5.10.2](https://github.com/mob-sakai/UIEffect/compare/5.10.1...5.10.2) (2025-10-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* [improve performance] code optimization ([e6fb78a](https://github.com/mob-sakai/UIEffect/commit/e6fb78a0f67ed6f70be08259f674ab2f83364bd7))
|
||||
|
||||
## [5.10.1](https://github.com/mob-sakai/UIEffect/compare/5.10.0...5.10.1) (2025-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* [improve performance] `UpdateViewMatrix` is called even though (direct-)parent canvas is disabled ([533d7b8](https://github.com/mob-sakai/UIEffect/commit/533d7b8c0a33871b1849fbda862d4fa1899822f4)), closes [#373](https://github.com/mob-sakai/UIEffect/issues/373)
|
||||
|
||||
# [5.10.0](https://github.com/mob-sakai/UIEffect/compare/5.9.7...5.10.0) (2025-09-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* `TmpProxy` causes loss of modifications from other `IMeshModifiers` ([c4202b4](https://github.com/mob-sakai/UIEffect/commit/c4202b45d28fa84567a5671baaef8fa3e3df85dc)), closes [#371](https://github.com/mob-sakai/UIEffect/issues/371)
|
||||
* display may disappear when using TMP SubMesh (multi-language or sprites, etc.) ([b4adb32](https://github.com/mob-sakai/UIEffect/commit/b4adb325120eeed64af1d9cb2468a1e1e8e10812)), closes [#372](https://github.com/mob-sakai/UIEffect/issues/372)
|
||||
* TMP Text sprite submesh lost when changing fontMaterial ([59874dd](https://github.com/mob-sakai/UIEffect/commit/59874ddffe356f927dc8ff9b157c54043e149522)), closes [#368](https://github.com/mob-sakai/UIEffect/issues/368)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* [improve performance] merged apply_color function and reduced shader compilation size ([ce69258](https://github.com/mob-sakai/UIEffect/commit/ce692580a33c0c433fd7fadb64a3dcda0121b2ff))
|
||||
* [improve performance] various view matrices are only updated when necessary ([6c808aa](https://github.com/mob-sakai/UIEffect/commit/6c808aa3417450fd1ce0fc6fbfe0adffdff9a79a))
|
||||
|
||||
## [5.9.7](https://github.com/mob-sakai/UIEffect/compare/5.9.6...5.9.7) (2025-09-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* edges of `TransitionFilter.Shiny` appear sharp ([b077d97](https://github.com/mob-sakai/UIEffect/commit/b077d97ed706acbbdd3b20e765ec0552fa464f9b)), closes [#366](https://github.com/mob-sakai/UIEffect/issues/366)
|
||||
* error message sometimes after importing assets ([3207105](https://github.com/mob-sakai/UIEffect/commit/3207105a067801696de789d282c74a93b798ed57)), closes [#365](https://github.com/mob-sakai/UIEffect/issues/365)
|
||||
* flickering issue when scale Y changes when used `ShadowMode` with TextMeshPro ([4cca2fb](https://github.com/mob-sakai/UIEffect/commit/4cca2fb5ab34ea454ff8df3def5f1730a71a198c)), closes [#367](https://github.com/mob-sakai/UIEffect/issues/367)
|
||||
* skip monitoring TMP objects that can ignore Y-axis scaling ([d1adb33](https://github.com/mob-sakai/UIEffect/commit/d1adb33884971aa7d6c473fcd08cdf25e58cd261))
|
||||
|
||||
## [5.9.6](https://github.com/mob-sakai/UIEffect/compare/5.9.5...5.9.6) (2025-07-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* `ColorFilter` does not output intended color when vertex color is not white ([9dffdb0](https://github.com/mob-sakai/UIEffect/commit/9dffdb0ed88750a915fdd5e437b79ab766ce45c2)), closes [#363](https://github.com/mob-sakai/UIEffect/issues/363)
|
||||
* draw calls increase even when using `UIEffectReplica` ([83128eb](https://github.com/mob-sakai/UIEffect/commit/83128ebb09305e4c15a58968a94550179e96ffac)), closes [#364](https://github.com/mob-sakai/UIEffect/issues/364)
|
||||
|
||||
## [5.9.5](https://github.com/mob-sakai/UIEffect/compare/5.9.4...5.9.5) (2025-06-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* `GetGradientKeys` and `GetTransitionGradientKeys` cannot get GradientMode ([fd2d1b8](https://github.com/mob-sakai/UIEffect/commit/fd2d1b80592ac4ea62e15b6150be63964b113fa2)), closes [#358](https://github.com/mob-sakai/UIEffect/issues/358)
|
||||
|
||||
## [5.9.4](https://github.com/mob-sakai/UIEffect/compare/5.9.3...5.9.4) (2025-06-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* colors specified in UIEffect are output differently in linear color space ([0d7fb1e](https://github.com/mob-sakai/UIEffect/commit/0d7fb1eb63881b67f2658567750a83c92187df35)), closes [#359](https://github.com/mob-sakai/UIEffect/issues/359)
|
||||
|
||||
## [5.9.3](https://github.com/mob-sakai/UIEffect/compare/5.9.2...5.9.3) (2025-06-23)
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
public override void DrawBackground(TimelineClip clip, ClipBackgroundRegion region)
|
||||
{
|
||||
var director = TimelineEditor.inspectedDirector;
|
||||
if (!director) return;
|
||||
if (director == null) return;
|
||||
|
||||
var viewDuration = region.endTime - region.startTime;
|
||||
var inDuration = (float)Math.Max(clip.easeInDuration, clip.blendInDuration);
|
||||
@@ -38,7 +38,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
}
|
||||
|
||||
var floatClip = clip.asset as UIEffectFloatClip;
|
||||
if (floatClip)
|
||||
if (floatClip != null)
|
||||
{
|
||||
if (track is GradationRotationTrack || track is GradationOffsetTrack)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
protected override void DrawBackground(Rect rect, TimelineClip clip)
|
||||
{
|
||||
var asset = clip.asset as UIEffectFloatClip;
|
||||
if (!asset) return;
|
||||
if (asset == null) return;
|
||||
|
||||
if (s_FromStyle == null)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
protected override void DrawBackground(Rect p, TimelineClip clip)
|
||||
{
|
||||
var asset = clip.asset as UIEffectColorClip;
|
||||
if (!asset) return;
|
||||
if (asset == null) return;
|
||||
|
||||
var d = asset.m_Data;
|
||||
if (d.m_Tween)
|
||||
|
||||
@@ -24,8 +24,8 @@ namespace Coffee.UIEffects.Editors
|
||||
|
||||
private static bool expandOthers
|
||||
{
|
||||
set => UIEffectEditorSettings.instance.m_ExpandOthers = value;
|
||||
get => UIEffectEditorSettings.instance.m_ExpandOthers;
|
||||
set => UIEffectEditorSettings.instance.m_ExpandOthers = value;
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
|
||||
@@ -10,22 +10,21 @@ using UnityEditorInternal;
|
||||
namespace Coffee.UIEffects.Editors
|
||||
{
|
||||
[CustomEditor(typeof(UIEffectProjectSettings))]
|
||||
public class UIEffectProjectSettingsEditor : Editor
|
||||
internal class UIEffectProjectSettingsEditor : PreloadedProjectSettingsEditor
|
||||
{
|
||||
private ReorderableList _reorderableList;
|
||||
private SerializedProperty _runtimePresets;
|
||||
private SerializedProperty _runtimePresetsV2;
|
||||
private SerializedProperty _useHDRColorPicker;
|
||||
private bool _isInitialized;
|
||||
private ShaderVariantRegistryEditor _shaderVariantRegistryEditor;
|
||||
private UIEffect[] _legacyPresets;
|
||||
private bool _expandRuntimePresets;
|
||||
private bool _expandLegacyPrefabs;
|
||||
|
||||
private void InitializeIfNeeded()
|
||||
protected override void OnEnable()
|
||||
{
|
||||
if (_isInitialized) return;
|
||||
|
||||
base.OnEnable();
|
||||
_legacyPresets = UIEffectProjectSettings.LoadEditorPresets();
|
||||
_useHDRColorPicker = serializedObject.FindProperty("m_UseHDRColorPicker");
|
||||
_runtimePresets = serializedObject.FindProperty("m_RuntimePresets");
|
||||
_runtimePresetsV2 = serializedObject.FindProperty("m_RuntimePresetsV2");
|
||||
@@ -39,7 +38,7 @@ namespace Coffee.UIEffects.Editors
|
||||
rect.y += 2;
|
||||
rect.height = EditorGUIUtility.singleLineHeight;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(effect && effect.hideFlags == HideFlags.NotEditable);
|
||||
EditorGUI.BeginDisabledGroup(effect != null && effect.hideFlags == HideFlags.NotEditable);
|
||||
EditorGUI.PropertyField(rect, element, GUIContent.none);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
};
|
||||
@@ -50,23 +49,18 @@ namespace Coffee.UIEffects.Editors
|
||||
UIEffectProjectSettings.RegisterRuntimePreset);
|
||||
};
|
||||
|
||||
_isInitialized = true;
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_legacyPresets = UIEffectProjectSettings.LoadEditorPresets();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
_isInitialized = false;
|
||||
_shaderVariantRegistryEditor = ShaderVariantRegistryEditor.Create(serializedObject, "(UIEffect)",
|
||||
() =>
|
||||
{
|
||||
UIEffectProjectSettings.shaderRegistry
|
||||
.RegisterOptionalShaders(UIEffectProjectSettings.instance);
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
InitializeIfNeeded();
|
||||
EditorGUIUtility.labelWidth = 180;
|
||||
base.OnInspectorGUI();
|
||||
|
||||
// Settings
|
||||
// Runtime Presets
|
||||
@@ -83,27 +77,18 @@ namespace Coffee.UIEffects.Editors
|
||||
// Shader registry
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Shader", EditorStyles.boldLabel);
|
||||
if (_shaderVariantRegistryEditor == null)
|
||||
{
|
||||
var property = serializedObject.FindProperty("m_ShaderVariantRegistry");
|
||||
_shaderVariantRegistryEditor = new ShaderVariantRegistryEditor(property, "(UIEffect)",
|
||||
() =>
|
||||
{
|
||||
UIEffectProjectSettings.shaderRegistry
|
||||
.RegisterOptionalShaders(UIEffectProjectSettings.instance);
|
||||
});
|
||||
}
|
||||
|
||||
_shaderVariantRegistryEditor.Draw();
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
DrawPreLoadSettingsInBuild("UIEffect");
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
GUILayout.FlexibleSpace();
|
||||
}
|
||||
|
||||
private void DrawLegacyPresets()
|
||||
{
|
||||
for (var i = _runtimePresets.arraySize - 1; 0 <= i; i--)
|
||||
{
|
||||
if (!_runtimePresets.GetArrayElementAtIndex(i).objectReferenceValue)
|
||||
if (_runtimePresets.GetArrayElementAtIndex(i).objectReferenceValue == null)
|
||||
{
|
||||
_runtimePresets.DeleteArrayElementAtIndex(i);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a9c54e67e8c9495fa77bfe119825877
|
||||
timeCreated: 1487152293
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
|
||||
@@ -229,8 +229,6 @@ namespace Coffee.UIEffects.Editors
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
EditorGUI.EndChangeCheck();
|
||||
|
||||
// Sampling filter
|
||||
DrawSeparator();
|
||||
if (DrawHeaderPopup(_samplingFilter))
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Coffee.UIEffects.Editors
|
||||
|
||||
var r = EditorGUILayout.GetControlRect();
|
||||
r.width -= 120;
|
||||
if (_preset.objectReferenceValue)
|
||||
if (_preset.objectReferenceValue != null)
|
||||
{
|
||||
EditorGUI.PropertyField(r, _preset);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ namespace Coffee.UIEffects.Editors
|
||||
EditorGUILayout.PropertyField(_allowToModifyMeshShape);
|
||||
|
||||
var parent = _target.objectReferenceValue ?? _preset.objectReferenceValue;
|
||||
if (parent)
|
||||
if (parent != null)
|
||||
{
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
CreateCachedEditor(parent, null, ref _uiEffectEditor);
|
||||
|
||||
@@ -90,8 +90,9 @@ namespace Coffee.UIEffects.Editors
|
||||
|
||||
private void DrawPlayer(UIEffectTweener tweener)
|
||||
{
|
||||
if (!tweener) return;
|
||||
if (tweener == null) return;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(!tweener.enabled);
|
||||
EditorGUILayout.Space(4);
|
||||
GUILayout.Label(GUIContent.none, "sv_iconselector_sep", GUILayout.ExpandWidth(true));
|
||||
|
||||
@@ -101,6 +102,7 @@ namespace Coffee.UIEffects.Editors
|
||||
if (GUI.Button(rResetTimeButton, EditorGUIUtility.IconContent("animation.firstkey"), "IconButton"))
|
||||
{
|
||||
ResetTime();
|
||||
EditorApplication.QueuePlayerLoopUpdate();
|
||||
}
|
||||
|
||||
var rPlayButton = new Rect(r.x + 20, r.y, 20, r.height);
|
||||
@@ -148,12 +150,15 @@ namespace Coffee.UIEffects.Editors
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
SetTime(time);
|
||||
EditorApplication.QueuePlayerLoopUpdate();
|
||||
}
|
||||
|
||||
if (Application.isPlaying && tweener.isActiveAndEnabled)
|
||||
{
|
||||
Repaint();
|
||||
}
|
||||
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
private static float DrawBackground(Rect r, float width, Color color)
|
||||
@@ -168,6 +173,7 @@ namespace Coffee.UIEffects.Editors
|
||||
{
|
||||
foreach (var tweener in targets.OfType<UIEffectTweener>())
|
||||
{
|
||||
if (!tweener.enabled) continue;
|
||||
tweener.SetTime(time);
|
||||
}
|
||||
}
|
||||
@@ -176,6 +182,7 @@ namespace Coffee.UIEffects.Editors
|
||||
{
|
||||
foreach (var tweener in targets.OfType<UIEffectTweener>())
|
||||
{
|
||||
if (!tweener.enabled) continue;
|
||||
tweener.ResetTime(tweener.direction);
|
||||
}
|
||||
}
|
||||
@@ -210,6 +217,7 @@ namespace Coffee.UIEffects.Editors
|
||||
_lastTime = EditorApplication.timeSinceStartup;
|
||||
foreach (var tweener in targets.OfType<UIEffectTweener>())
|
||||
{
|
||||
if (!tweener.enabled) continue;
|
||||
tweener.UpdateTime(tweener.direction == UIEffectTweener.Direction.Forward ? delta : -delta);
|
||||
}
|
||||
|
||||
|
||||
+105
-8
@@ -60,6 +60,7 @@ Apply professional-grade filters like grayscale, blur, and dissolve directly fro
|
||||
- [Usage with SoftMaskForUGUI](#usage-with-softmaskforugui)
|
||||
- [Usage with ShaderGraph](#usage-with-shadergraph)
|
||||
- [Usage with Timeline](#usage-with-timeline)
|
||||
- [Usage with Custom Shader](#usage-with-custom-shader)
|
||||
- [Runtime/Editor Preset for UIEffect](#runtimeeditor-preset-for-uieffect)
|
||||
- [Usage with Code](#usage-with-code)
|
||||
- [Project Settings](#project-settings)
|
||||
@@ -122,7 +123,7 @@ _This package requires **Unity 2020.3 or later**._
|
||||
```
|
||||
- To update the package, use Package Manager UI (`Window > Package Manager`) or run the following command with `@{version}`:
|
||||
```
|
||||
openupm add com.coffee.ui-effect@5.9.0
|
||||
openupm add com.coffee.ui-effect@5.12.0
|
||||
```
|
||||
|
||||
### Install via UPM (with Package Manager UI)
|
||||
@@ -131,7 +132,7 @@ _This package requires **Unity 2020.3 or later**._
|
||||
- Click `+ > Add package from git URL...` and input the repository URL: `https://github.com/mob-sakai/UIEffect.git?path=Packages/src`
|
||||

|
||||
- To update the package, change suffix `#{version}` to the target version.
|
||||
- e.g. `https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.9.0`
|
||||
- e.g. `https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.12.0`
|
||||
|
||||
### Install via UPM (Manually)
|
||||
|
||||
@@ -146,7 +147,7 @@ _This package requires **Unity 2020.3 or later**._
|
||||
```
|
||||
|
||||
- To update the package, change suffix `#{version}` to the target version.
|
||||
- e.g. `"com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.9.0",`
|
||||
- e.g. `"com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.12.0",`
|
||||
|
||||
### Install as Embedded Package
|
||||
|
||||
@@ -166,6 +167,53 @@ Additional resources can be imported to extend functionality.
|
||||
- [Usage with TextMeshPro](#usage-with-textmeshpro)
|
||||
- [Usage with ShaderGraph](#usage-with-shadergraph)
|
||||
|
||||
#### Install Additional Resources as Packages
|
||||
|
||||
Starting with v5.12.0, you can install optional resources as separate UPM packages instead of importing them as samples.
|
||||
This lets you use the features you need without adding their assets to your project's `Assets/Samples` directory.
|
||||
|
||||
> [!TIP]
|
||||
> Use the **same version as the UIEffect package**.
|
||||
> If you have already imported a resource as a sample, delete its corresponding sample from `Assets/Samples/UI Effect/{version}` before installing the package.
|
||||
|
||||
The following optional packages are available from the OpenUPM registry.
|
||||
Choose the package that matches your Unity version and render pipeline, then replace `5.12.0` with your UIEffect package version if needed.
|
||||
|
||||
```sh
|
||||
# TextMeshPro support (Unity 2023.2 or earlier)
|
||||
openupm add com.coffee.ui-effect.textmeshpro-legacy@5.12.0
|
||||
# TextMeshPro support (Unity 2023.3 or later)
|
||||
openupm add com.coffee.ui-effect.textmeshpro@5.12.0
|
||||
# ShaderGraph support (Unity 6, Built-in Render Pipeline)
|
||||
openupm add com.coffee.ui-effect.shadergraph-builtin@5.12.0
|
||||
# ShaderGraph support (Unity 6, URP)
|
||||
openupm add com.coffee.ui-effect.shadergraph-urp@5.12.0
|
||||
# v4 compatible components
|
||||
openupm add com.coffee.ui-effect.v4-compatible-components@5.12.0
|
||||
```
|
||||
|
||||
For manual installation, add the desired package entries to your `Packages/manifest.json` file, install the package through Package Manager, or embed the package in your project.
|
||||
The following is a valid `manifest.json` dependencies example; remove entries for resources you do not need.
|
||||
Use only one TextMeshPro support package, and select the ShaderGraph package for your render pipeline.
|
||||
|
||||
```json
|
||||
{
|
||||
"dependencies": {
|
||||
// TextMeshPro Support (2023.2 or earlier):
|
||||
"com.coffee.ui-effect.textmeshpro-legacy": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src/Samples~/com.coffee.ui-effect.textmeshpro-legacy#5.12.0",
|
||||
// TextMeshPro Support (2023.3, 6000.0 or later):
|
||||
"com.coffee.ui-effect.textmeshpro": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src/Samples~/com.coffee.ui-effect.textmeshpro#5.12.0",
|
||||
// ShaderGraph Support (Unity 6, Builtin):
|
||||
"com.coffee.ui-effect.shadergraph-builtin": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src/Samples~/com.coffee.ui-effect.shadergraph-builtin#5.12.0",
|
||||
// ShaderGraph Support (Unity 6, URP):
|
||||
"com.coffee.ui-effect.shadergraph-urp": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src/Samples~/com.coffee.ui-effect.shadergraph-urp#5.12.0",
|
||||
// v4 Compatible Components:
|
||||
"com.coffee.ui-effect.v4-compatible-components": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src/Samples~/com.coffee.ui-effect.v4-compatible-components#5.12.0",
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br><br>
|
||||
|
||||
## 🔄 Upgrading from v4 to v5
|
||||
@@ -184,6 +232,10 @@ If upgrading from UIEffect v4 to v5, note the following breaking changes:
|
||||
```
|
||||
|
||||
2. Import the `v4 Compatible Components` sample from the Package Manager window.
|
||||
> [!TIP]
|
||||
> "Additional Resources" can be installed as a package from v5.12.0 or later.
|
||||
> For more information, please refer to the [Install Additional Resources](#import-additional-resources) section.
|
||||
|
||||
|
||||
3. All v4 components are obsolete.
|
||||
- v4 `UIEffect` component is now `UIEffectV4` component. Change the reference in the code.
|
||||
@@ -210,9 +262,10 @@ If upgrading from UIEffect v4 to v5, note the following breaking changes:
|
||||

|
||||
|
||||
5. From the top menu, you can load/append preset.
|
||||
> [!TIP]
|
||||
> `Load` overwrites all properties with the preset, while `Append` only overwrites enabled filters and modes with the preset.
|
||||
> You can easily build effects by combining them with `Append`.
|
||||
> [!TIP]
|
||||
>
|
||||
> `Load` overwrites all properties with the preset, while `Append` only overwrites enabled filters and modes with the preset.
|
||||
> You can easily build effects by combining them with `Append`.
|
||||
|
||||

|
||||
|
||||
@@ -458,8 +511,8 @@ You can preview the animation using the seek bar and play button.
|
||||
The `UIEffectReplica` component applies visual effects to UI elements by replicating the settings of another `UIEffect` component. This allows the same effect to be applied across multiple UI elements simultaneously.
|
||||
|
||||
- **Target**: The target `UIEffect` component to replicate.
|
||||
> [!TIP]
|
||||
> You can specify a preset as well as an instance as the target for `UIEffectReplica`.
|
||||
> [!TIP]
|
||||
> You can specify a preset as well as an instance as the target for `UIEffectReplica`.
|
||||
- **Use Target Transform**: Use the target's transform for some effects.
|
||||

|
||||
- **Custom Root**: Use the custom transform for some effects.
|
||||
@@ -470,6 +523,10 @@ The `UIEffectReplica` component applies visual effects to UI elements by replica
|
||||
|
||||
### Usage with TextMeshPro
|
||||
|
||||
> [!TIP]
|
||||
> "Additional Resources" can be installed as a package from v5.12.0 or later.
|
||||
> For more information, please refer to the [Install Additional Resources](#import-additional-resources) section.
|
||||
|
||||
To use UIEffect with TextMeshPro, you need to import additional resources.
|
||||
When a shader included in the samples is requested, an import dialog will automatically appear.
|
||||
Click the `Import` button.
|
||||
@@ -514,6 +571,12 @@ Click the `Import` button.
|
||||
|
||||
### Usage with ShaderGraph
|
||||
|
||||
> [!TIP]
|
||||
> "Additional Resources" can be installed as a package from v5.12.0 or later.
|
||||
> For more information, please refer to the [Install Additional Resources](#import-additional-resources) section.
|
||||
|
||||
⚠️ ShaderGraph support is available only in Unity 2023.2/6.0 or later.
|
||||
|
||||

|
||||
|
||||
To use UIEffect with ShaderGraph, you need to import additional resources.
|
||||
@@ -543,6 +606,25 @@ Timeline is a powerful animation tool that can control UIEffect using `ControlTr
|
||||
|
||||
<br><br>
|
||||
|
||||
### Usage with Custom Shader
|
||||
|
||||
To make your custom shader support UIEffect, it must satisfy the following requirements.
|
||||
Refer to the sections enclosed by `==== UIEFFECT START ===` and `==== UIEFFECT END ====` in the built-in `Hidden/UI/Default (UIEffect)` shader included in the package.
|
||||
|
||||
https://github.com/mob-sakai/UIEffect/blob/main/Packages/src/Shaders/UIEffect.shader
|
||||
|
||||
- Blend: `Blend [_SrcBlend] [_DstBlend]`
|
||||
- Shader variants: `#pragma shader_feature_local_fragment ***`
|
||||
- Vertex shader input structure: `float4 uvMask : TEXCOORD***;`
|
||||
- Vertex shader: `OUT.uvMask = v.uvMask;` and `OUT.worldPosition = v.vertex;`
|
||||
- Pixel shader input structure: `float4 uvMask : TEXCOORD***;` and `float4 worldPosition : TEXCOORD***;`
|
||||
- UIEffect micro pixel shader: a function that returns the color of the specified pixel and has the signature `half4 uieffect_frag(v2f IN, float2 uv)`.
|
||||
- Pixel shader input structure name definition: `#define UIEFFECT_FRAG_STRUCT v2f`
|
||||
- Include the UIEffect library: `#include "Packages/com.coffee.ui-effect/Shaders/UIEffect.cginc"`
|
||||
- Pixel shader: `half4 c = uieffect(IN.texcoord, IN.uvMask, IN.worldPosition, IN);`
|
||||
|
||||
<br><br>
|
||||
|
||||
### Runtime/Editor Preset for UIEffect
|
||||
|
||||

|
||||
@@ -629,6 +711,21 @@ You can adjust the project-wide settings for UIEffect. (`Edit > Project Settings
|
||||
> - The setting file is usually saved in `Assets/ProjectSettings/UIEffectProjectSettings.asset`. Include this file in your version control system.
|
||||
> - The setting file is automatically added as a preloaded asset in `ProjectSettings/ProjectSettings.asset`.
|
||||
|
||||
#### Advanced
|
||||
|
||||
- **Pre Load Settings In Build**: When enabled, this settings asset will be added to `PlayerSettings.preloadedAssets` in build.
|
||||
- When disable, you should load this settings via `Resources`, `AssetBundles` or `Addressables` to use `UIEffect`.
|
||||
- You can overwrite the settings by re-enabling `UIEffectProjectSettings`. This allows you to hot update shader variants and presets.
|
||||
|
||||
```csharp
|
||||
private static IEnumerator HotUpdateCoroutine()
|
||||
{
|
||||
const string k_SettingsAddress = "Assets/ProjectSettings/UIEffectProjectSettings.asset";
|
||||
yield return Addressables.LoadAssetAsync<UIEffectProjectSettings>(k_SettingsAddress);
|
||||
while (UIEffectProjectSettings.shaderVariantCollection.WarmUpProgressively(5) == false) yield return null;
|
||||
}
|
||||
```
|
||||
|
||||
<br><br>
|
||||
|
||||
### :warning: Limitations
|
||||
|
||||
@@ -112,8 +112,10 @@ namespace Coffee.UIEffects
|
||||
Vertical = 3,
|
||||
VerticalGradient = 4,
|
||||
Radial = 5,
|
||||
|
||||
[Obsolete]
|
||||
RadialFast = 5,
|
||||
|
||||
[Obsolete]
|
||||
RadialDetail = 6,
|
||||
RadialGradient = 12,
|
||||
|
||||
@@ -12,6 +12,33 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
internal static class ComponentExtensions
|
||||
{
|
||||
#if !UNITY_2019_2_OR_NEWER
|
||||
public static bool TryGetComponent<T>(this GameObject self, out T component)
|
||||
where T : Component
|
||||
{
|
||||
if (self == null)
|
||||
{
|
||||
component = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
component = self.GetComponent<T>();
|
||||
return component != null;
|
||||
}
|
||||
|
||||
public static bool TryGetComponent<T>(this Component self, out T component)
|
||||
where T : Component
|
||||
{
|
||||
if (self == null)
|
||||
{
|
||||
component = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
return self.gameObject.TryGetComponent(out component);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Get components in children of a specific type in the hierarchy of a GameObject.
|
||||
/// </summary>
|
||||
@@ -31,14 +58,17 @@ namespace Coffee.UIEffectInternal
|
||||
public static void GetComponentsInChildren<T>(this Component self, List<T> results, int depth)
|
||||
where T : Component
|
||||
{
|
||||
if (results == null) return;
|
||||
|
||||
results.Clear();
|
||||
if (self == null) return;
|
||||
self.GetComponentsInChildren_Internal(results, depth);
|
||||
}
|
||||
|
||||
private static void GetComponentsInChildren_Internal<T>(this Component self, List<T> results, int depth)
|
||||
where T : Component
|
||||
{
|
||||
if (!self || results == null || depth < 0) return;
|
||||
if (self == null || results == null || depth < 0) return;
|
||||
|
||||
var tr = self.transform;
|
||||
if (tr.TryGetComponent<T>(out var t))
|
||||
@@ -59,7 +89,7 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static T GetOrAddComponent<T>(this Component self) where T : Component
|
||||
{
|
||||
if (!self) return null;
|
||||
if (self == null) return null;
|
||||
return self.TryGetComponent<T>(out var component)
|
||||
? component
|
||||
: self.gameObject.AddComponent<T>();
|
||||
@@ -70,9 +100,11 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static T GetRootComponent<T>(this Component self) where T : Component
|
||||
{
|
||||
if (self == null) return null;
|
||||
|
||||
T component = null;
|
||||
var transform = self.transform;
|
||||
while (transform)
|
||||
while (transform != null)
|
||||
{
|
||||
if (transform.TryGetComponent<T>(out var c))
|
||||
{
|
||||
@@ -92,8 +124,10 @@ namespace Coffee.UIEffectInternal
|
||||
Predicate<T> valid)
|
||||
where T : Component
|
||||
{
|
||||
if (self == null || valid == null) return null;
|
||||
|
||||
var tr = includeSelf ? self.transform : self.transform.parent;
|
||||
while (tr)
|
||||
while (tr != null)
|
||||
{
|
||||
if (tr.TryGetComponent<T>(out var c) && valid(c)) return c;
|
||||
if (tr == stopAfter) return null;
|
||||
@@ -166,11 +200,11 @@ namespace Coffee.UIEffectInternal
|
||||
#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
|
||||
{
|
||||
if (!self) return null;
|
||||
if (self == null) return null;
|
||||
if (!includeInactive) return self.GetComponentInParent<T>();
|
||||
|
||||
var current = self.transform;
|
||||
while (current)
|
||||
while (current != null)
|
||||
{
|
||||
if (current.TryGetComponent<T>(out var c)) return c;
|
||||
current = current.parent;
|
||||
@@ -186,7 +220,7 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
internal static bool CanConvertTo<T>(this Object context) where T : MonoBehaviour
|
||||
{
|
||||
return context && context.GetType() != typeof(T);
|
||||
return context != null && context.GetType() != typeof(T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Coffee.UIEffectInternal
|
||||
mesh => mesh,
|
||||
mesh =>
|
||||
{
|
||||
if (mesh)
|
||||
if (mesh != null)
|
||||
{
|
||||
mesh.Clear();
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public static void CopyTo(this Mesh self, Mesh dst)
|
||||
{
|
||||
if (!self || !dst) return;
|
||||
if (self == null || dst == null) return;
|
||||
|
||||
var vector3List = InternalListPool<Vector3>.Rent();
|
||||
var vector4List = InternalListPool<Vector4>.Rent();
|
||||
@@ -80,9 +80,16 @@ namespace Coffee.UIEffectInternal
|
||||
InternalListPool<int>.Return(ref intList);
|
||||
}
|
||||
|
||||
public static void CopyTo(this VertexHelper self, Mesh dst)
|
||||
{
|
||||
if (self == null || dst == null) return;
|
||||
|
||||
self.FillMesh(dst);
|
||||
}
|
||||
|
||||
public static void CopyTo(this Mesh self, VertexHelper dst)
|
||||
{
|
||||
if (!self || dst == null) return;
|
||||
if (self == null || dst == null) return;
|
||||
|
||||
var vertexCount = self.vertexCount;
|
||||
var indexCount = self.triangles.Length;
|
||||
@@ -91,12 +98,14 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public static void CopyTo(this Mesh self, VertexHelper dst, int vertexCount, int indexCount)
|
||||
{
|
||||
if (!self || dst == null) return;
|
||||
if (self == null || dst == null) return;
|
||||
|
||||
var positions = InternalListPool<Vector3>.Rent();
|
||||
var normals = InternalListPool<Vector3>.Rent();
|
||||
var uv0 = InternalListPool<Vector4>.Rent();
|
||||
var uv1 = InternalListPool<Vector4>.Rent();
|
||||
var uv2 = InternalListPool<Vector4>.Rent();
|
||||
var uv3 = InternalListPool<Vector4>.Rent();
|
||||
var tangents = InternalListPool<Vector4>.Rent();
|
||||
var colors = InternalListPool<Color32>.Rent();
|
||||
var indices = InternalListPool<int>.Rent();
|
||||
@@ -104,6 +113,8 @@ namespace Coffee.UIEffectInternal
|
||||
self.GetColors(colors);
|
||||
self.GetUVs(0, uv0);
|
||||
self.GetUVs(1, uv1);
|
||||
self.GetUVs(2, uv2);
|
||||
self.GetUVs(3, uv3);
|
||||
self.GetNormals(normals);
|
||||
self.GetTangents(tangents);
|
||||
self.GetIndices(indices, 0);
|
||||
@@ -112,7 +123,7 @@ namespace Coffee.UIEffectInternal
|
||||
for (var i = 0; i < vertexCount; i++)
|
||||
{
|
||||
dst.AddVert(positions.GetOrDefault(i), colors.GetOrDefault(i), uv0.GetOrDefault(i), uv1.GetOrDefault(i),
|
||||
normals.GetOrDefault(i), tangents.GetOrDefault(i));
|
||||
uv2.GetOrDefault(i), uv3.GetOrDefault(i), normals.GetOrDefault(i), tangents.GetOrDefault(i));
|
||||
}
|
||||
|
||||
var count = Mathf.Clamp(indexCount, 0, indices.Count);
|
||||
@@ -125,6 +136,8 @@ namespace Coffee.UIEffectInternal
|
||||
InternalListPool<Vector3>.Return(ref normals);
|
||||
InternalListPool<Vector4>.Return(ref uv0);
|
||||
InternalListPool<Vector4>.Return(ref uv1);
|
||||
InternalListPool<Vector4>.Return(ref uv2);
|
||||
InternalListPool<Vector4>.Return(ref uv3);
|
||||
InternalListPool<Vector4>.Return(ref tangents);
|
||||
InternalListPool<Color32>.Return(ref colors);
|
||||
InternalListPool<int>.Return(ref indices);
|
||||
|
||||
@@ -14,20 +14,49 @@ namespace Coffee.UIEffectInternal
|
||||
public abstract class PreloadedProjectSettings : ScriptableObject
|
||||
#if UNITY_EDITOR
|
||||
{
|
||||
private class Postprocessor : AssetPostprocessor
|
||||
[Tooltip("When enabled, this settings asset will be added to PlayerSettings.preloadedAssets in build.\n\n" +
|
||||
"When disable, you should load this settings via Resources, AssetBundles or Addressables to use.")]
|
||||
[SerializeField]
|
||||
[Header("Advanced")]
|
||||
[HideInInspector]
|
||||
private bool m_PreLoadSettingsInBuild = true;
|
||||
|
||||
protected static bool s_BuildingPlayer;
|
||||
|
||||
private class EditorEvents : AssetPostprocessor, IPreprocessBuildWithReport, IPostprocessBuildWithReport
|
||||
{
|
||||
int IOrderedCallback.callbackOrder => 0;
|
||||
|
||||
private static void OnPostprocessAllAssets(string[] _, string[] __, string[] ___, string[] ____)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
private class PreprocessBuildWithReport : IPreprocessBuildWithReport
|
||||
{
|
||||
int IOrderedCallback.callbackOrder => 0;
|
||||
|
||||
void IPreprocessBuildWithReport.OnPreprocessBuild(BuildReport report)
|
||||
{
|
||||
AssetDatabase.Refresh();
|
||||
Initialize();
|
||||
s_BuildingPlayer = true;
|
||||
|
||||
foreach (var t in TypeCache.GetTypesDerivedFrom(typeof(PreloadedProjectSettings<>)))
|
||||
{
|
||||
var settings = GetDefaultSettings(t);
|
||||
if (settings == null || settings.m_PreLoadSettingsInBuild) continue;
|
||||
|
||||
PlayerSettings.SetPreloadedAssets(
|
||||
PlayerSettings.GetPreloadedAssets()
|
||||
.Where(x => x != null && x.GetType() != t)
|
||||
.ToArray());
|
||||
|
||||
Debug.Log($"[PreloadedProjectSettings] Build started: removed '{settings.name}' " +
|
||||
$"({t.Name}) from PreloadedAssets. " +
|
||||
$"It will be restored after build completes.");
|
||||
}
|
||||
}
|
||||
|
||||
void IPostprocessBuildWithReport.OnPostprocessBuild(BuildReport report)
|
||||
{
|
||||
s_BuildingPlayer = false;
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
@@ -37,18 +66,21 @@ namespace Coffee.UIEffectInternal
|
||||
foreach (var t in TypeCache.GetTypesDerivedFrom(typeof(PreloadedProjectSettings<>)))
|
||||
{
|
||||
var defaultSettings = GetDefaultSettings(t);
|
||||
if (!defaultSettings)
|
||||
if (defaultSettings == null)
|
||||
{
|
||||
// When create a new instance, automatically set it as default settings.
|
||||
defaultSettings = CreateInstance(t) as PreloadedProjectSettings;
|
||||
SetDefaultSettings(defaultSettings);
|
||||
if (!s_BuildingPlayer)
|
||||
{
|
||||
// When create a new instance, automatically set it as default settings.
|
||||
defaultSettings = CreateInstance(t) as PreloadedProjectSettings;
|
||||
SetDefaultSettings(defaultSettings);
|
||||
}
|
||||
}
|
||||
else if (GetPreloadedSettings(t).Length != 1)
|
||||
{
|
||||
SetDefaultSettings(defaultSettings);
|
||||
if (!s_BuildingPlayer) SetDefaultSettings(defaultSettings);
|
||||
}
|
||||
|
||||
if (defaultSettings)
|
||||
if (defaultSettings != null)
|
||||
{
|
||||
defaultSettings.OnInitialize();
|
||||
}
|
||||
@@ -66,22 +98,22 @@ namespace Coffee.UIEffectInternal
|
||||
private static Object[] GetPreloadedSettings(Type type)
|
||||
{
|
||||
return PlayerSettings.GetPreloadedAssets()
|
||||
.Where(x => x && x.GetType() == type)
|
||||
.Where(x => x != null && x.GetType() == type)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
protected static PreloadedProjectSettings GetDefaultSettings(Type type)
|
||||
{
|
||||
return GetPreloadedSettings(type).FirstOrDefault() as PreloadedProjectSettings
|
||||
?? AssetDatabase.FindAssets($"t:{nameof(PreloadedProjectSettings)}")
|
||||
?? AssetDatabase.FindAssets($"t:{type.Name}")
|
||||
.Select(AssetDatabase.GUIDToAssetPath)
|
||||
.Select(AssetDatabase.LoadAssetAtPath<PreloadedProjectSettings>)
|
||||
.FirstOrDefault(x => x && x.GetType() == type);
|
||||
.FirstOrDefault(x => x != null && x.GetType() == type);
|
||||
}
|
||||
|
||||
protected static void SetDefaultSettings(PreloadedProjectSettings asset)
|
||||
{
|
||||
if (!asset) return;
|
||||
if (asset == null) return;
|
||||
|
||||
var type = asset.GetType();
|
||||
if (string.IsNullOrEmpty(AssetDatabase.GetAssetPath(asset)))
|
||||
@@ -103,7 +135,7 @@ namespace Coffee.UIEffectInternal
|
||||
var preloadedAssets = PlayerSettings.GetPreloadedAssets();
|
||||
var projectSettings = GetPreloadedSettings(type);
|
||||
PlayerSettings.SetPreloadedAssets(preloadedAssets
|
||||
.Where(x => x)
|
||||
.Where(x => x != null)
|
||||
.Except(projectSettings.Except(new[] { asset }))
|
||||
.Append(asset)
|
||||
.Distinct()
|
||||
@@ -120,6 +152,37 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract class PreloadedProjectSettingsEditor : Editor
|
||||
{
|
||||
private SerializedProperty _preLoadSettingsInBuild;
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
_preLoadSettingsInBuild = serializedObject.FindProperty("m_PreLoadSettingsInBuild");
|
||||
}
|
||||
|
||||
protected void DrawPreLoadSettingsInBuild(string packageName)
|
||||
{
|
||||
if (_preLoadSettingsInBuild == null) return;
|
||||
|
||||
EditorGUILayout.PropertyField(_preLoadSettingsInBuild);
|
||||
if (!_preLoadSettingsInBuild.boolValue)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.HelpBox(
|
||||
$"{target.GetType().Name} asset will not be built in.\n" +
|
||||
$"please load manually from Resources, AssetBundle, or Addressables before using {packageName}.",
|
||||
MessageType.Warning);
|
||||
if (GUILayout.Button("Ping"))
|
||||
{
|
||||
EditorGUIUtility.PingObject(target);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
}
|
||||
@@ -133,31 +196,33 @@ namespace Coffee.UIEffectInternal
|
||||
#if UNITY_EDITOR
|
||||
private string _jsonText;
|
||||
|
||||
public static bool hasInstance => s_Instance;
|
||||
public static bool hasInstance => s_Instance != null;
|
||||
|
||||
public static T instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_Instance) return s_Instance;
|
||||
if (s_Instance != null) return s_Instance;
|
||||
|
||||
s_Instance = GetDefaultSettings(typeof(T)) as T;
|
||||
if (s_Instance) return s_Instance;
|
||||
if (s_Instance != null) return s_Instance;
|
||||
|
||||
s_Instance = CreateInstance<T>();
|
||||
if (!s_Instance)
|
||||
if (s_Instance == null)
|
||||
{
|
||||
s_Instance = null;
|
||||
return s_Instance;
|
||||
}
|
||||
|
||||
SetDefaultSettings(s_Instance);
|
||||
if (!s_BuildingPlayer) SetDefaultSettings(s_Instance);
|
||||
return s_Instance;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPlayModeStateChanged(PlayModeStateChange state)
|
||||
{
|
||||
if (this == null) return;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case PlayModeStateChange.ExitingEditMode:
|
||||
@@ -174,7 +239,7 @@ namespace Coffee.UIEffectInternal
|
||||
}
|
||||
}
|
||||
#else
|
||||
public static T instance => s_Instance ? s_Instance : s_Instance = CreateInstance<T>();
|
||||
public static T instance => s_Instance != null ? s_Instance : s_Instance = CreateInstance<T>();
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -183,17 +248,21 @@ namespace Coffee.UIEffectInternal
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
var isDefaultSettings = !s_Instance || s_Instance == this || GetDefaultSettings(typeof(T)) == this;
|
||||
var isDefaultSettings = s_Instance == null || s_Instance == this || GetDefaultSettings(typeof(T)) == this;
|
||||
if (!isDefaultSettings)
|
||||
{
|
||||
DestroyImmediate(this, true);
|
||||
return;
|
||||
}
|
||||
|
||||
EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;
|
||||
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
|
||||
#else
|
||||
if (s_Instance != null && s_Instance != this)
|
||||
{
|
||||
Destroy(s_Instance);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (s_Instance) return;
|
||||
s_Instance = this as T;
|
||||
}
|
||||
|
||||
@@ -222,18 +291,22 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public override void OnGUI(string searchContext)
|
||||
{
|
||||
if (!_target)
|
||||
if (_target == null)
|
||||
{
|
||||
if (_editor)
|
||||
if (_editor != null)
|
||||
{
|
||||
DestroyImmediate(_editor);
|
||||
_editor = null;
|
||||
}
|
||||
|
||||
_target = instance;
|
||||
if (_target == null) return;
|
||||
|
||||
_editor = Editor.CreateEditor(_target);
|
||||
}
|
||||
|
||||
if (_editor == null) return;
|
||||
|
||||
_editor.OnInspectorGUI();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Coffee.UIEffectInternal
|
||||
foreach (var shaderName in s_ShaderNames)
|
||||
{
|
||||
var shader = Shader.Find(shaderName);
|
||||
if (!shader) continue;
|
||||
if (shader == null) continue;
|
||||
|
||||
var hasCgincError = ShaderUtil.GetShaderMessages(shader)
|
||||
.Any(x => Regex.IsMatch(x.message, $"Couldn't open include file.*{s_CgincPattern}"));
|
||||
|
||||
@@ -51,6 +51,8 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
protected void Invoke(Action<T> callback)
|
||||
{
|
||||
if (callback == null) return;
|
||||
|
||||
var node = _delegates.First;
|
||||
while (node != null)
|
||||
{
|
||||
@@ -66,11 +68,6 @@ namespace Coffee.UIEffectInternal
|
||||
node = node.Next;
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_delegates.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Coffee.UIEffectInternal
|
||||
@@ -8,25 +9,32 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
private static readonly Dictionary<Type, IFrameCache> s_Caches = new Dictionary<Type, IFrameCache>();
|
||||
|
||||
static FrameCache()
|
||||
{
|
||||
s_Caches.Clear();
|
||||
UIExtraCallbacks.onLateAfterCanvasRebuild += ClearAllCache;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||
[InitializeOnLoadMethod]
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
#elif UNITY_EDITOR
|
||||
[InitializeOnLoadMethod]
|
||||
#else
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
#endif
|
||||
private static void Clear()
|
||||
{
|
||||
s_Caches.Clear();
|
||||
UIExtraCallbacks.onLateAfterCanvasRebuild -= ClearAllCache;
|
||||
UIExtraCallbacks.onLateAfterCanvasRebuild += ClearAllCache;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Tries to retrieve a value from the frame cache with a specified key.
|
||||
/// </summary>
|
||||
public static bool TryGet<T>(object key1, string key2, out T result)
|
||||
{
|
||||
if (key1 == null || key2 == null)
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
return GetFrameCache<T>().TryGet((key1.GetHashCode(), key2.GetHashCode()), out result);
|
||||
}
|
||||
|
||||
@@ -35,6 +43,12 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static bool TryGet<T>(object key1, string key2, int key3, out T result)
|
||||
{
|
||||
if (key1 == null || key2 == null)
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
return GetFrameCache<T>().TryGet((key1.GetHashCode(), key2.GetHashCode() + key3), out result);
|
||||
}
|
||||
|
||||
@@ -43,6 +57,8 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static void Set<T>(object key1, string key2, T result)
|
||||
{
|
||||
if (key1 == null || key2 == null) return;
|
||||
|
||||
GetFrameCache<T>().Set((key1.GetHashCode(), key2.GetHashCode()), result);
|
||||
}
|
||||
|
||||
@@ -51,6 +67,8 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static void Set<T>(object key1, string key2, int key3, T result)
|
||||
{
|
||||
if (key1 == null || key2 == null) return;
|
||||
|
||||
GetFrameCache<T>().Set((key1.GetHashCode(), key2.GetHashCode() + key3), result);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -11,7 +11,7 @@ using Conditional = System.Diagnostics.ConditionalAttribute;
|
||||
|
||||
namespace Coffee.UIEffectInternal
|
||||
{
|
||||
internal static class Logging
|
||||
internal static class Logger
|
||||
{
|
||||
#if !ENABLE_COFFEE_LOGGER
|
||||
private const string k_DisableSymbol = "DISABLE_COFFEE_LOGGER";
|
||||
@@ -48,7 +48,7 @@ namespace Coffee.UIEffectInternal
|
||||
public static void LogIf(bool enable, object tag, object message, Object context = null)
|
||||
{
|
||||
if (!enable) return;
|
||||
Log_Internal(LogType.Log, tag, message, context ? context : tag as Object);
|
||||
Log_Internal(LogType.Log, tag, message, context != null ? context : tag as Object);
|
||||
}
|
||||
|
||||
#if !ENABLE_COFFEE_LOGGER
|
||||
@@ -56,7 +56,7 @@ namespace Coffee.UIEffectInternal
|
||||
#endif
|
||||
public static void Log(object tag, object message, Object context = null)
|
||||
{
|
||||
Log_Internal(LogType.Log, tag, message, context ? context : tag as Object);
|
||||
Log_Internal(LogType.Log, tag, message, context != null ? context : tag as Object);
|
||||
}
|
||||
|
||||
#if !ENABLE_COFFEE_LOGGER
|
||||
@@ -64,13 +64,13 @@ namespace Coffee.UIEffectInternal
|
||||
#endif
|
||||
public static void LogWarning(object tag, object message, Object context = null)
|
||||
{
|
||||
Log_Internal(LogType.Warning, tag, message, context ? context : tag as Object);
|
||||
Log_Internal(LogType.Warning, tag, message, context != null ? context : tag as Object);
|
||||
}
|
||||
|
||||
public static void LogError(object tag, object message, Object context = null)
|
||||
{
|
||||
#if ENABLE_COFFEE_LOGGER
|
||||
Log_Internal(LogType.Error, tag, message, context ? context : tag as Object);
|
||||
Log_Internal(LogType.Error, tag, message, context != null ? context : tag as Object);
|
||||
#else
|
||||
Debug.LogError($"{tag}: {message}", context);
|
||||
#endif
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f0dee01a862040a58ac6b6057944cd3
|
||||
guid: a2fa34e76bcd14489a1af18b393c3e65
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -13,7 +13,9 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public static int count => s_Repository.count;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static Func<string, Shader> onShaderFind = Shader.Find;
|
||||
|
||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
public static void Clear()
|
||||
{
|
||||
@@ -47,8 +49,10 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static void Get(Hash128 hash, ref Material material, string shaderName)
|
||||
{
|
||||
if (onShaderFind == null) return;
|
||||
|
||||
Profiler.BeginSample("(COF)[MaterialRepository] Get");
|
||||
s_Repository.Get(hash, ref material, x => new Material(Shader.Find(x))
|
||||
s_Repository.Get(hash, ref material, x => new Material(onShaderFind(x))
|
||||
{
|
||||
hideFlags = HideFlags.DontSave | HideFlags.NotEditable
|
||||
}, shaderName);
|
||||
@@ -60,8 +64,10 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static void Get(Hash128 hash, ref Material material, string shaderName, string[] keywords)
|
||||
{
|
||||
if (onShaderFind == null) return;
|
||||
|
||||
Profiler.BeginSample("(COF)[MaterialRepository] Get");
|
||||
s_Repository.Get(hash, ref material, x => new Material(Shader.Find(x.shaderName))
|
||||
s_Repository.Get(hash, ref material, x => new Material(onShaderFind(x.shaderName))
|
||||
{
|
||||
hideFlags = HideFlags.DontSave | HideFlags.NotEditable,
|
||||
shaderKeywords = x.keywords
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Diagnostics;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
using Debug = UnityEngine.Debug;
|
||||
#if UNITY_EDITOR
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -20,7 +21,9 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
public static T[] FindObjectsOfType<T>() where T : Object
|
||||
{
|
||||
#if UNITY_2023_1_OR_NEWER
|
||||
#if UNITY_6000_4_OR_NEWER
|
||||
return Object.FindObjectsByType<T>(FindObjectsInactive.Include);
|
||||
#elif UNITY_2023_1_OR_NEWER
|
||||
return Object.FindObjectsByType<T>(FindObjectsInactive.Include, FindObjectsSortMode.None);
|
||||
#else
|
||||
return Object.FindObjectsOfType<T>();
|
||||
@@ -29,7 +32,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public static void Destroy(Object obj)
|
||||
{
|
||||
if (!obj) return;
|
||||
if (obj == null) return;
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
@@ -44,24 +47,19 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public static void DestroyImmediate(Object obj)
|
||||
{
|
||||
if (!obj) return;
|
||||
if (obj == null) return;
|
||||
#if UNITY_EDITOR
|
||||
if (Application.isEditor)
|
||||
{
|
||||
Object.DestroyImmediate(obj);
|
||||
}
|
||||
else
|
||||
Object.DestroyImmediate(obj, true);
|
||||
#else
|
||||
Object.Destroy(obj);
|
||||
#endif
|
||||
{
|
||||
Object.Destroy(obj);
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("UNITY_EDITOR")]
|
||||
public static void SetDirty(Object obj)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (!obj) return;
|
||||
if (obj == null) return;
|
||||
EditorUtility.SetDirty(obj);
|
||||
#endif
|
||||
}
|
||||
@@ -70,7 +68,7 @@ namespace Coffee.UIEffectInternal
|
||||
public static T[] GetAllComponentsInPrefabStage<T>() where T : Component
|
||||
{
|
||||
var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
|
||||
if (prefabStage == null) return Array.Empty<T>();
|
||||
if (prefabStage == null || prefabStage.prefabContentsRoot == null) return Array.Empty<T>();
|
||||
|
||||
return prefabStage.prefabContentsRoot.GetComponentsInChildren<T>(true);
|
||||
}
|
||||
@@ -105,23 +103,28 @@ namespace Coffee.UIEffectInternal
|
||||
#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>;
|
||||
?.CreateDelegate(typeof(Action<Object, Texture2D>), null) as Action<Object, Texture2D>;
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
private static void InitializeOnLoadMethod()
|
||||
{
|
||||
if (Misc.isBatchOrBuilding) return;
|
||||
if (s_SetIconForObject == null)
|
||||
{
|
||||
Debug.LogError("Could not retrieve the object icon API.");
|
||||
return;
|
||||
}
|
||||
|
||||
var types = TypeCache.GetTypesWithAttribute<IconAttribute>();
|
||||
var types = TypeCache.GetTypesWithAttribute(typeof(IconAttribute));
|
||||
var scripts = MonoImporter.GetAllRuntimeMonoScripts();
|
||||
foreach (var type in types)
|
||||
{
|
||||
var script = scripts.FirstOrDefault(x => x.GetClass() == type);
|
||||
if (!script) continue;
|
||||
if (script == null) continue;
|
||||
|
||||
var path = type.GetCustomAttribute<IconAttribute>()?._path;
|
||||
var icon = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
|
||||
if (!icon) continue;
|
||||
if (icon == null) continue;
|
||||
|
||||
s_SetIconForObject(script, icon);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Coffee.UIEffectInternal
|
||||
}
|
||||
|
||||
// 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}).");
|
||||
Logger.Log(this, $"A new instance is created (pooled: {_pool.CountInactive}, created: {_pool.CountAll}).");
|
||||
return _pool.Get();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Coffee.UIEffectInternal
|
||||
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}).");
|
||||
Logger.Log(this, $"An instance is released (pooled: {_pool.CountInactive}, created: {_pool.CountAll}).");
|
||||
instance = default; // Set the reference to null.
|
||||
}
|
||||
#else
|
||||
@@ -80,7 +80,7 @@ namespace Coffee.UIEffectInternal
|
||||
}
|
||||
|
||||
// If there are no instances in the pool, create a new one.
|
||||
Logging.Log(this, $"A new instance is created (pooled: {_pool.Count}, created: {++_count}).");
|
||||
Logger.Log(this, $"A new instance is created (pooled: {_pool.Count}, created: {++_count}).");
|
||||
return _onCreate();
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
_onReturn(instance); // Return the instance to the pool.
|
||||
_pool.Push(instance);
|
||||
Logging.Log(this, $"An instance is released (pooled: {_pool.Count}, created: {_count}).");
|
||||
Logger.Log(this, $"An instance is released (pooled: {_pool.Count}, created: {_count}).");
|
||||
instance = default; // Set the reference to null.
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -71,6 +71,8 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public void Get(Hash128 hash, ref T obj, Func<T> onCreate)
|
||||
{
|
||||
if (onCreate == null) return;
|
||||
|
||||
if (GetFromCache(hash, ref obj)) return;
|
||||
Add(hash, ref obj, onCreate());
|
||||
}
|
||||
@@ -80,6 +82,8 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public void Get<TS>(Hash128 hash, ref T obj, Func<TS, T> onCreate, TS source)
|
||||
{
|
||||
if (onCreate == null) return;
|
||||
|
||||
if (GetFromCache(hash, ref obj)) return;
|
||||
Add(hash, ref obj, onCreate(source));
|
||||
}
|
||||
@@ -90,9 +94,9 @@ namespace Coffee.UIEffectInternal
|
||||
Profiler.BeginSample("(COF)[ObjectRepository] GetFromCache");
|
||||
if (_cache.TryGetValue(hash, out var entry))
|
||||
{
|
||||
if (!entry.storedObject)
|
||||
if (entry.storedObject == null)
|
||||
{
|
||||
Release(ref entry.storedObject);
|
||||
Remove(entry);
|
||||
Profiler.EndSample();
|
||||
return false;
|
||||
}
|
||||
@@ -103,7 +107,7 @@ namespace Coffee.UIEffectInternal
|
||||
Release(ref obj);
|
||||
++entry.reference;
|
||||
obj = entry.storedObject;
|
||||
Logging.Log(_name, $"Get(total#{count}): {entry}");
|
||||
Logger.Log(_name, $"Get(total#{count}): {entry}");
|
||||
}
|
||||
|
||||
Profiler.EndSample();
|
||||
@@ -116,7 +120,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
private void Add(Hash128 hash, ref T obj, T newObject)
|
||||
{
|
||||
if (!newObject)
|
||||
if (newObject == null)
|
||||
{
|
||||
Release(ref obj);
|
||||
obj = newObject;
|
||||
@@ -127,11 +131,12 @@ namespace Coffee.UIEffectInternal
|
||||
Profiler.BeginSample("(COF)[ObjectRepository] Add");
|
||||
var newEntry = 0 < _pool.Count ? _pool.Pop() : new Entry();
|
||||
newEntry.storedObject = newObject;
|
||||
newEntry.objectId = newObject.GetHashCode();
|
||||
newEntry.hash = hash;
|
||||
newEntry.reference = 1;
|
||||
_cache[hash] = newEntry;
|
||||
_objectKey[newObject.GetInstanceID()] = hash;
|
||||
Logging.Log(_name, $"<color=#03c700>Add</color>(total#{count}): {newEntry}");
|
||||
_objectKey[newEntry.objectId] = hash;
|
||||
Logger.Log(_name, $"<color=#03c700>Add</color>(total#{count}): {newEntry}");
|
||||
Release(ref obj);
|
||||
obj = newObject;
|
||||
Profiler.EndSample();
|
||||
@@ -146,23 +151,23 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
// Find and release the entry.
|
||||
Profiler.BeginSample("(COF)[ObjectRepository] Release");
|
||||
var id = obj.GetInstanceID();
|
||||
var id = obj.GetHashCode();
|
||||
if (_objectKey.TryGetValue(id, out var hash)
|
||||
&& _cache.TryGetValue(hash, out var entry))
|
||||
{
|
||||
entry.reference--;
|
||||
if (entry.reference <= 0 || !entry.storedObject)
|
||||
if (entry.reference <= 0 || entry.storedObject == null)
|
||||
{
|
||||
Remove(entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Log(_name, $"Release(total#{_cache.Count}): {entry}");
|
||||
Logger.Log(_name, $"Release(total#{_cache.Count}): {entry}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Log(_name, $"Release(total#{_cache.Count}): <color=red>Already released: {obj}</color>");
|
||||
Logger.Log(_name, $"Release(total#{_cache.Count}): <color=red>Already released: {obj}</color>");
|
||||
}
|
||||
|
||||
obj = null;
|
||||
@@ -175,10 +180,10 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
Profiler.BeginSample("(COF)[ObjectRepository] Remove");
|
||||
_cache.Remove(entry.hash);
|
||||
_objectKey.Remove(entry.storedObject.GetInstanceID());
|
||||
_objectKey.Remove(entry.objectId);
|
||||
_pool.Push(entry);
|
||||
entry.reference = 0;
|
||||
Logging.Log(_name, $"<color=#f29e03>Remove</color>(total#{_cache.Count}): {entry}");
|
||||
Logger.Log(_name, $"<color=#f29e03>Remove</color>(total#{_cache.Count}): {entry}");
|
||||
entry.Release(_onRelease);
|
||||
Profiler.EndSample();
|
||||
}
|
||||
@@ -186,13 +191,15 @@ namespace Coffee.UIEffectInternal
|
||||
private class Entry
|
||||
{
|
||||
public Hash128 hash;
|
||||
public int objectId;
|
||||
public int reference;
|
||||
public T storedObject;
|
||||
|
||||
public void Release(Action<T> onRelease)
|
||||
{
|
||||
reference = 0;
|
||||
if (storedObject)
|
||||
objectId = 0;
|
||||
if (storedObject != null)
|
||||
{
|
||||
onRelease?.Invoke(storedObject);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#if UNITY_EDITOR
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
@@ -12,17 +11,24 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
internal static class ShaderSampleImporter
|
||||
{
|
||||
private static string s_ReadmeUrl;
|
||||
private static (string shaderName, string sampleName, string version)[] s_Samples;
|
||||
private static (string guid, string fileName)[] s_DeprecatedShaders;
|
||||
private static readonly Dictionary<string, string> s_SampleNames = new Dictionary<string, string>();
|
||||
private static readonly Dictionary<string, string> s_ShaderAliases = new Dictionary<string, string>();
|
||||
|
||||
public static void RegisterReadmeUrl(string url)
|
||||
{
|
||||
s_ReadmeUrl = url;
|
||||
}
|
||||
|
||||
public static void RegisterShaderSamples((string shaderName, string sampleName, string version)[] samples)
|
||||
{
|
||||
if (IsBatchOrBuilding()) return;
|
||||
if (samples == null || IsBatchOrBuilding()) return;
|
||||
|
||||
// Collect sample names.
|
||||
s_Samples = samples;
|
||||
s_SampleNames.Clear();
|
||||
foreach (var (shaderName, sampleName, _) in samples)
|
||||
{
|
||||
s_SampleNames[shaderName] = sampleName;
|
||||
@@ -31,6 +37,8 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public static void RegisterShaderAliases((string, string)[] aliases)
|
||||
{
|
||||
if (aliases == null) return;
|
||||
|
||||
foreach (var (from, to) in aliases)
|
||||
{
|
||||
s_ShaderAliases[from] = to;
|
||||
@@ -51,7 +59,7 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static bool ImportShaderIfSelected(string shaderName)
|
||||
{
|
||||
if (IsBatchOrBuilding()) return false;
|
||||
if (string.IsNullOrEmpty(shaderName) || IsBatchOrBuilding()) return false;
|
||||
|
||||
if (s_ShaderAliases.TryGetValue(shaderName, out var alias))
|
||||
{
|
||||
@@ -62,6 +70,11 @@ namespace Coffee.UIEffectInternal
|
||||
if (s_SampleNames.TryGetValue(shaderName, out var sampleName))
|
||||
{
|
||||
var message = $"Import the sample '{sampleName}' to use the shader '{shaderName}'.";
|
||||
if (!string.IsNullOrWhiteSpace(s_ReadmeUrl))
|
||||
{
|
||||
message += "\n\nFor details, please see the readme.";
|
||||
}
|
||||
|
||||
return ImportSampleIfSelected(sampleName, message);
|
||||
}
|
||||
|
||||
@@ -85,8 +98,22 @@ namespace Coffee.UIEffectInternal
|
||||
// Import the sample if selected.
|
||||
if (!string.IsNullOrEmpty(message))
|
||||
{
|
||||
var selected = EditorUtility.DisplayDialog($"Import {sampleName}", message, "Import", "Cancel");
|
||||
if (!selected) return false;
|
||||
if (!string.IsNullOrWhiteSpace(s_ReadmeUrl))
|
||||
{
|
||||
var selected = EditorUtility.DisplayDialogComplex(
|
||||
$"Import {sampleName}", message, "Import", "Cancel", "Show Readme");
|
||||
if (selected == 2)
|
||||
{
|
||||
Application.OpenURL(s_ReadmeUrl);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (selected != 0) return false;
|
||||
}
|
||||
else if (!EditorUtility.DisplayDialog($"Import {sampleName}", message, "Import", "Cancel"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the imported sample name from the list.
|
||||
@@ -107,18 +134,19 @@ namespace Coffee.UIEffectInternal
|
||||
if (string.IsNullOrEmpty(shaderName)) return null;
|
||||
|
||||
var shader = Shader.Find(shaderName);
|
||||
if (!shader) return null;
|
||||
if (shader == null) return null;
|
||||
|
||||
var path = AssetDatabase.GetAssetPath(shader);
|
||||
if (string.IsNullOrEmpty(path)) return null;
|
||||
|
||||
return AssetImporter.GetAtPath(path).userData;
|
||||
var importer = AssetImporter.GetAtPath(path);
|
||||
return importer != null ? importer.userData : null;
|
||||
}
|
||||
|
||||
private static void DeleteShader(string shaderName)
|
||||
{
|
||||
var shader = Shader.Find(shaderName);
|
||||
if (shader)
|
||||
if (shader != null)
|
||||
{
|
||||
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(shader));
|
||||
}
|
||||
@@ -156,12 +184,15 @@ namespace Coffee.UIEffectInternal
|
||||
}
|
||||
|
||||
// Remove deprecated shaders.
|
||||
foreach (var (guid, fileName) in s_DeprecatedShaders)
|
||||
if (s_DeprecatedShaders != null)
|
||||
{
|
||||
var path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
if (!string.IsNullOrEmpty(path) && Path.GetFileName(path) == fileName)
|
||||
foreach (var (guid, fileName) in s_DeprecatedShaders)
|
||||
{
|
||||
AssetDatabase.DeleteAsset(path);
|
||||
var path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
if (!string.IsNullOrEmpty(path) && Path.GetFileName(path) == fileName)
|
||||
{
|
||||
AssetDatabase.DeleteAsset(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using UnityEngine.Profiling;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
@@ -16,7 +17,7 @@ using Object = UnityEngine.Object;
|
||||
namespace Coffee.UIEffectInternal
|
||||
{
|
||||
[Serializable]
|
||||
public class ShaderVariantRegistry
|
||||
public sealed class ShaderVariantRegistry
|
||||
{
|
||||
[Serializable]
|
||||
internal class StringPair : IEquatable<StringPair>
|
||||
@@ -26,9 +27,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public bool Equals(StringPair other)
|
||||
{
|
||||
if (other == null) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
return key == other.key && value == other.value;
|
||||
return other != null && key == other.key && value == other.value;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -46,6 +45,7 @@ namespace Coffee.UIEffectInternal
|
||||
}
|
||||
|
||||
private Dictionary<int, string> _cachedOptionalShaders = new Dictionary<int, string>();
|
||||
private Dictionary<string, Shader> _shaderByName;
|
||||
|
||||
[SerializeField]
|
||||
private List<StringPair> m_OptionalShaders = new List<StringPair>();
|
||||
@@ -53,6 +53,9 @@ namespace Coffee.UIEffectInternal
|
||||
[SerializeField]
|
||||
internal ShaderVariantCollection m_Asset;
|
||||
|
||||
[SerializeField]
|
||||
private List<Shader> m_RegisteredShaders = new List<Shader>();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[SerializeField]
|
||||
private bool m_ErrorOnUnregisteredVariant = false;
|
||||
@@ -64,18 +67,76 @@ namespace Coffee.UIEffectInternal
|
||||
public ShaderVariantCollection shaderVariantCollection => m_Asset;
|
||||
public Func<string, bool> onShaderRequested;
|
||||
|
||||
/// <summary>
|
||||
/// Build the runtime name-to-shader lookup from <see cref="m_RegisteredShaders"/>.
|
||||
/// When shaders are delivered via AssetBundles (i.e. not in the player build),
|
||||
/// <see cref="Shader.Find"/> cannot locate them by name. This lookup provides
|
||||
/// direct references serialized at edit-time as a reliable alternative.
|
||||
/// </summary>
|
||||
public void InitializeShaderLookup()
|
||||
{
|
||||
if (_shaderByName == null)
|
||||
{
|
||||
_shaderByName = new Dictionary<string, Shader>();
|
||||
}
|
||||
else
|
||||
{
|
||||
_shaderByName.Clear();
|
||||
}
|
||||
|
||||
if (m_RegisteredShaders == null) return;
|
||||
|
||||
var count = m_RegisteredShaders.Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var s = m_RegisteredShaders[i];
|
||||
if (s != null)
|
||||
{
|
||||
_shaderByName[s.name] = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find a shader by name. Prefers the registered direct reference from
|
||||
/// <see cref="m_RegisteredShaders"/> when available, falls back to
|
||||
/// <see cref="Shader.Find"/> otherwise. This ensures correct behavior in both
|
||||
/// built-in delivery (PreloadedAssets) and external delivery (AssetBundle) modes.
|
||||
/// </summary>
|
||||
public Shader FindShaderByName(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) return null;
|
||||
|
||||
if (_shaderByName != null && _shaderByName.TryGetValue(name, out var shader) && shader != null)
|
||||
{
|
||||
return shader;
|
||||
}
|
||||
|
||||
return Shader.Find(name);
|
||||
}
|
||||
|
||||
public Shader FindOptionalShader(Shader shader,
|
||||
string requiredName,
|
||||
string format,
|
||||
string defaultOptionalShaderName)
|
||||
{
|
||||
if (!shader) return null;
|
||||
if (shader == null) return null;
|
||||
|
||||
if (_cachedOptionalShaders == null)
|
||||
{
|
||||
_cachedOptionalShaders = new Dictionary<int, string>();
|
||||
}
|
||||
|
||||
if (m_OptionalShaders == null)
|
||||
{
|
||||
m_OptionalShaders = new List<StringPair>();
|
||||
}
|
||||
|
||||
// Already cached.
|
||||
var id = shader.GetInstanceID();
|
||||
var id = shader.GetHashCode();
|
||||
if (_cachedOptionalShaders.TryGetValue(id, out var optionalShaderName))
|
||||
{
|
||||
return Shader.Find(optionalShaderName);
|
||||
return FindShaderByName(optionalShaderName);
|
||||
}
|
||||
|
||||
// The shader has required name.
|
||||
@@ -88,21 +149,23 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
// Find optional shader.
|
||||
Shader optionalShader;
|
||||
foreach (var pair in m_OptionalShaders)
|
||||
var count = m_OptionalShaders.Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var pair = m_OptionalShaders[i];
|
||||
if (pair == null) continue;
|
||||
|
||||
if (pair.key != shaderName) continue;
|
||||
optionalShader = Shader.Find(pair.value);
|
||||
if (optionalShader)
|
||||
{
|
||||
_cachedOptionalShaders[id] = pair.value;
|
||||
return optionalShader;
|
||||
}
|
||||
optionalShader = FindShaderByName(pair.value);
|
||||
if (optionalShader == null) continue;
|
||||
_cachedOptionalShaders[id] = pair.value;
|
||||
return optionalShader;
|
||||
}
|
||||
|
||||
// Find optional shader by format.
|
||||
optionalShaderName = string.Format(format, shaderName);
|
||||
optionalShader = Shader.Find(optionalShaderName);
|
||||
if (optionalShader)
|
||||
optionalShader = FindShaderByName(optionalShaderName);
|
||||
if (optionalShader != null)
|
||||
{
|
||||
_cachedOptionalShaders[id] = optionalShaderName;
|
||||
return optionalShader;
|
||||
@@ -111,21 +174,34 @@ namespace Coffee.UIEffectInternal
|
||||
#if UNITY_EDITOR
|
||||
if (onShaderRequested?.Invoke(optionalShaderName) ?? false)
|
||||
{
|
||||
return Shader.Find(defaultOptionalShaderName);
|
||||
return FindShaderByName(defaultOptionalShaderName);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Find default optional shader.
|
||||
_cachedOptionalShaders[id] = defaultOptionalShaderName;
|
||||
return Shader.Find(defaultOptionalShaderName);
|
||||
return FindShaderByName(defaultOptionalShaderName);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private readonly HashSet<StringPair> _logVariants = new HashSet<StringPair>();
|
||||
private readonly StringBuilder _sb = new StringBuilder(1024);
|
||||
|
||||
private readonly Dictionary<Hash128, (ShaderVariantCollection.ShaderVariant, StringPair)> _cachedVariants =
|
||||
new Dictionary<Hash128, (ShaderVariantCollection.ShaderVariant, StringPair)>();
|
||||
|
||||
public void ClearCache()
|
||||
{
|
||||
_cachedOptionalShaders.Clear();
|
||||
if (_cachedOptionalShaders == null)
|
||||
{
|
||||
_cachedOptionalShaders = new Dictionary<int, string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
_cachedOptionalShaders.Clear();
|
||||
}
|
||||
|
||||
_cachedVariants.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -134,6 +210,7 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public void RegisterOptionalShaders(Object owner)
|
||||
{
|
||||
if (owner == null) return;
|
||||
var shaderPaths = ShaderUtil.GetAllShaderInfo()
|
||||
.Select(s => AssetDatabase.GetAssetPath(Shader.Find(s.name)))
|
||||
.Where(path => !string.IsNullOrEmpty(path) && path.EndsWith(".shader"))
|
||||
@@ -150,6 +227,7 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
private void RegisterOptionalShaders(Object owner, string path)
|
||||
{
|
||||
if (owner == null) return;
|
||||
if (!File.Exists(path) || !path.EndsWith(".shader")) return;
|
||||
|
||||
var packageName = PackageInfo.FindForAssembly(typeof(ShaderVariantRegistry).Assembly)?.name;
|
||||
@@ -157,7 +235,10 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
// Register optional shader names by shader comment.
|
||||
var pattern = $"// \\[OptionalShader\\] {packageName}: (.*)$";
|
||||
var registeredKeys = new HashSet<string>(m_OptionalShaders.Select(x => x.key));
|
||||
m_OptionalShaders = m_OptionalShaders ?? new List<StringPair>();
|
||||
var registeredKeys = new HashSet<string>(m_OptionalShaders
|
||||
.Where(x => x != null)
|
||||
.Select(x => x.key));
|
||||
var keys = File.ReadLines(path)
|
||||
.Take(10)
|
||||
.Select(line => Regex.Match(line, pattern))
|
||||
@@ -168,7 +249,7 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
// Find shader.
|
||||
var shader = AssetDatabase.LoadAssetAtPath<Shader>(path);
|
||||
if (!shader) return;
|
||||
if (shader == null) return;
|
||||
|
||||
var shaderName = shader.name;
|
||||
foreach (var key in keys)
|
||||
@@ -182,14 +263,15 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public void InitializeIfNeeded(Object owner)
|
||||
{
|
||||
if (owner == null) return;
|
||||
Profiler.BeginSample("(EDITOR/COF)[ShaderVariantRegistry] InitializeIfNeeded");
|
||||
|
||||
if (!m_Asset && AssetDatabase.IsMainAsset(owner))
|
||||
if (m_Asset == null && AssetDatabase.IsMainAsset(owner))
|
||||
{
|
||||
// Find ShaderVariantCollection in owner.
|
||||
var path = AssetDatabase.GetAssetPath(owner);
|
||||
var collection = AssetDatabase.LoadAssetAtPath<ShaderVariantCollection>(path);
|
||||
if (collection)
|
||||
if (collection != null)
|
||||
{
|
||||
m_Asset = collection;
|
||||
}
|
||||
@@ -204,30 +286,58 @@ namespace Coffee.UIEffectInternal
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
SyncRegisteredShaders(owner);
|
||||
ClearCache();
|
||||
Profiler.EndSample();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sync <see cref="m_RegisteredShaders"/> based on the current delivery mode.
|
||||
/// When <see cref="PreloadedProjectSettings.excludeFromPreloadedAssetsWhenBuildPlayer"/> is enabled,
|
||||
/// extracts shader references from the SVC so they can be resolved at runtime
|
||||
/// without <see cref="Shader.Find"/>. Otherwise clears the list to avoid
|
||||
/// stale references and unnecessary asset dependencies.
|
||||
/// </summary>
|
||||
private void SyncRegisteredShaders(Object owner)
|
||||
{
|
||||
if (owner == null) return;
|
||||
if (m_Asset == null) return;
|
||||
var so = new SerializedObject(m_Asset);
|
||||
var shaders = so.FindProperty("m_Shaders");
|
||||
if (shaders == null) return;
|
||||
|
||||
// Get all shaders in the SVC, ignoring nulls and duplicates.
|
||||
var shadersInSVC = Enumerable.Range(0, shaders.arraySize)
|
||||
.Select(i =>
|
||||
shaders.GetArrayElementAtIndex(i).FindPropertyRelative("first").objectReferenceValue as Shader)
|
||||
.Where(s => s != null)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
// ShaderVariantCollection entry order is not stable between editor sessions.
|
||||
// The registry is a lookup set, so an order-only difference is already in sync.
|
||||
m_RegisteredShaders = m_RegisteredShaders ?? new List<Shader>();
|
||||
if (m_RegisteredShaders.Count == shadersInSVC.Count &&
|
||||
new HashSet<Shader>(m_RegisteredShaders).SetEquals(shadersInSVC))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_RegisteredShaders.Clear();
|
||||
m_RegisteredShaders.AddRange(shadersInSVC);
|
||||
EditorUtility.SetDirty(owner);
|
||||
}
|
||||
|
||||
internal void RegisterVariant(Material material, string path)
|
||||
{
|
||||
if (!material || !material.shader || !m_Asset) return;
|
||||
if (material == null || material.shader == null || m_Asset == null) return;
|
||||
m_UnregisteredVariants = m_UnregisteredVariants ?? new List<StringPair>();
|
||||
|
||||
Profiler.BeginSample("(EDITOR/COF)[ShaderVariantRegistry] RegisterVariant");
|
||||
var shaderName = material.shader.name;
|
||||
var validKeywords = material.shaderKeywords
|
||||
.Where(x => !Regex.IsMatch(x, "(_EDITOR|EDITOR_)"))
|
||||
.ToArray();
|
||||
var keywords = string.Join(" ", validKeywords);
|
||||
var variant = new ShaderVariantCollection.ShaderVariant
|
||||
{
|
||||
shader = material.shader,
|
||||
keywords = validKeywords
|
||||
};
|
||||
|
||||
// Already registered.
|
||||
var pair = new StringPair() { key = shaderName, value = keywords };
|
||||
var (variant, pair) = GetVariant(material);
|
||||
if (m_Asset.Contains(variant))
|
||||
{
|
||||
// Already registered.
|
||||
m_UnregisteredVariants.Remove(pair);
|
||||
Profiler.EndSample();
|
||||
return;
|
||||
@@ -243,7 +353,8 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
if (_logVariants.Add(pair))
|
||||
{
|
||||
keywords = string.IsNullOrEmpty(keywords) ? "no keywords" : keywords;
|
||||
var shaderName = pair.key;
|
||||
var keywords = string.IsNullOrEmpty(pair.value) ? "no keywords" : pair.value;
|
||||
Debug.LogError($"Shader variant '{shaderName} <{keywords}>' is not registered.\n" +
|
||||
$"Register it in 'ProjectSettings > {path}' to use it in player.", m_Asset);
|
||||
}
|
||||
@@ -256,6 +367,55 @@ namespace Coffee.UIEffectInternal
|
||||
m_UnregisteredVariants.Remove(pair);
|
||||
Profiler.EndSample();
|
||||
}
|
||||
|
||||
private (ShaderVariantCollection.ShaderVariant, StringPair) GetVariant(Material material)
|
||||
{
|
||||
Profiler.BeginSample("(EDITOR/COF)[ShaderVariantRegistry] GetVariant");
|
||||
var shader = material.shader;
|
||||
_sb.Length = 0;
|
||||
foreach (var keyword in material.shaderKeywords)
|
||||
{
|
||||
// Ignore editor keyword.
|
||||
if (keyword.Contains("_EDITOR") || keyword.Contains("EDITOR_")) continue;
|
||||
|
||||
_sb.Append(keyword);
|
||||
_sb.Append(' ');
|
||||
}
|
||||
|
||||
if (0 < _sb.Length)
|
||||
{
|
||||
_sb.Length--; // Remove last space.
|
||||
}
|
||||
|
||||
var hash = new Hash128((uint)shader.GetHashCode(), (uint)GetContentsHashCode(_sb), 0, 0);
|
||||
if (_cachedVariants.TryGetValue(hash, out var result))
|
||||
{
|
||||
Profiler.EndSample();
|
||||
return result;
|
||||
}
|
||||
|
||||
var pair = new StringPair() { key = shader.name, value = _sb.ToString() };
|
||||
var variant = new ShaderVariantCollection.ShaderVariant
|
||||
{
|
||||
shader = shader,
|
||||
keywords = pair.value.Split(' ')
|
||||
};
|
||||
|
||||
_cachedVariants.Add(hash, (variant, pair));
|
||||
Profiler.EndSample();
|
||||
return (variant, pair);
|
||||
}
|
||||
|
||||
private static int GetContentsHashCode(StringBuilder sb)
|
||||
{
|
||||
var hash = 17;
|
||||
for (var i = 0; i < sb.Length; i++)
|
||||
{
|
||||
hash = unchecked(hash * 31 + sb[i]);
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -274,7 +434,30 @@ namespace Coffee.UIEffectInternal
|
||||
private bool _expandOptionalShaders;
|
||||
private bool _expandUnregisteredVariants;
|
||||
|
||||
public ShaderVariantRegistryEditor(SerializedProperty property, string optionName, Action onFindOptions)
|
||||
public static ShaderVariantRegistryEditor CreateWithoutOption(SerializedObject so)
|
||||
{
|
||||
var property = so.FindProperty("m_ShaderVariantRegistry");
|
||||
return new ShaderVariantRegistryEditor(property, null, null);
|
||||
}
|
||||
|
||||
public static ShaderVariantRegistryEditor CreateWithoutOption(SerializedProperty property)
|
||||
{
|
||||
return new ShaderVariantRegistryEditor(property, null, null);
|
||||
}
|
||||
|
||||
public static ShaderVariantRegistryEditor Create(SerializedObject so, string optionName, Action onFindOptions)
|
||||
{
|
||||
var property = so.FindProperty("m_ShaderVariantRegistry");
|
||||
return new ShaderVariantRegistryEditor(property, optionName, onFindOptions);
|
||||
}
|
||||
|
||||
public static ShaderVariantRegistryEditor Create(SerializedProperty property, string optionName,
|
||||
Action onFindOptions)
|
||||
{
|
||||
return new ShaderVariantRegistryEditor(property, optionName, onFindOptions);
|
||||
}
|
||||
|
||||
private ShaderVariantRegistryEditor(SerializedProperty property, string optionName, Action onFindOptions)
|
||||
{
|
||||
var so = property.serializedObject;
|
||||
var optionalShaders = property.FindPropertyRelative("m_OptionalShaders");
|
||||
@@ -282,6 +465,54 @@ namespace Coffee.UIEffectInternal
|
||||
_errorOnUnregisteredVariant = property.FindPropertyRelative("m_ErrorOnUnregisteredVariant");
|
||||
_asset = property.FindPropertyRelative("m_Asset");
|
||||
|
||||
_rlUnregisteredVariants = new ReorderableList(so, unregisteredVariants, false, true, false, true);
|
||||
_rlUnregisteredVariants.drawHeaderCallback = rect =>
|
||||
{
|
||||
var rWarning = new Rect(rect.x, rect.y, 20, rect.height);
|
||||
var icon = EditorGUIUtility.TrIconContent("warning",
|
||||
"These variants are not registered.\nRegister them to use in player.");
|
||||
EditorGUI.LabelField(rWarning, icon);
|
||||
|
||||
var rLabel = new Rect(rect.x + 20, rect.y, 200, rect.height);
|
||||
EditorGUI.LabelField(rLabel, "Unregistered Shader Variants");
|
||||
|
||||
var rButton = new Rect(rect.x + rect.width - 60, rect.y, 60, rect.height - 4);
|
||||
if (GUI.Button(rButton, "Clear All", EditorStyles.miniButton))
|
||||
{
|
||||
unregisteredVariants.ClearArray();
|
||||
}
|
||||
};
|
||||
_rlUnregisteredVariants.elementHeight = EditorGUIUtility.singleLineHeight * 2 + 4;
|
||||
_rlUnregisteredVariants.drawElementCallback = (r, index, isActive, isFocused) =>
|
||||
{
|
||||
if (unregisteredVariants.arraySize <= index) return;
|
||||
|
||||
var element = unregisteredVariants.GetArrayElementAtIndex(index);
|
||||
if (element == null) return;
|
||||
|
||||
var key = element.FindPropertyRelative("key");
|
||||
var value = element.FindPropertyRelative("value");
|
||||
|
||||
var h = EditorGUIUtility.singleLineHeight;
|
||||
var rKey = new Rect(r.x, r.y + 2, r.width, h);
|
||||
EditorGUI.LabelField(rKey, key.stringValue, EditorStyles.popup);
|
||||
|
||||
var rValue = new Rect(r.x + 20, r.y + h + 5, r.width - 40, 14);
|
||||
var keywords = string.IsNullOrEmpty(value.stringValue) ? "<no keywords>" : value.stringValue;
|
||||
EditorGUI.TextField(rValue, GUIContent.none, keywords, "LODRenderersText");
|
||||
|
||||
var rButton = new Rect(r.x + r.width - 20, r.y + h + 4, 20, h);
|
||||
if (GUI.Button(rButton, EditorGUIUtility.IconContent("icons/toolbar plus.png"), "iconbutton"))
|
||||
{
|
||||
var collection = _asset.objectReferenceValue as ShaderVariantCollection;
|
||||
AddVariant(collection, key.stringValue, value.stringValue);
|
||||
unregisteredVariants.DeleteArrayElementAtIndex(index);
|
||||
}
|
||||
};
|
||||
|
||||
// Optional shaders.
|
||||
if (string.IsNullOrEmpty(optionName)) return;
|
||||
|
||||
_rlOptionalShaders = new ReorderableList(so, optionalShaders, true, true, true, true);
|
||||
_rlOptionalShaders.drawHeaderCallback = rect =>
|
||||
{
|
||||
@@ -328,56 +559,15 @@ namespace Coffee.UIEffectInternal
|
||||
ShowShaderDropdown(value);
|
||||
}
|
||||
};
|
||||
|
||||
_rlUnregisteredVariants = new ReorderableList(so, unregisteredVariants, false, true, false, true);
|
||||
_rlUnregisteredVariants.drawHeaderCallback = rect =>
|
||||
{
|
||||
var rWarning = new Rect(rect.x, rect.y, 20, rect.height);
|
||||
var icon = EditorGUIUtility.TrIconContent("warning",
|
||||
"These variants are not registered.\nRegister them to use in player.");
|
||||
EditorGUI.LabelField(rWarning, icon);
|
||||
|
||||
var rLabel = new Rect(rect.x + 20, rect.y, 200, rect.height);
|
||||
EditorGUI.LabelField(rLabel, "Unregistered Shader Variants");
|
||||
|
||||
var rButton = new Rect(rect.x + rect.width - 60, rect.y, 60, rect.height - 4);
|
||||
if (GUI.Button(rButton, "Clear All", EditorStyles.miniButton))
|
||||
{
|
||||
unregisteredVariants.ClearArray();
|
||||
}
|
||||
};
|
||||
_rlUnregisteredVariants.elementHeight = EditorGUIUtility.singleLineHeight * 2 + 4;
|
||||
_rlUnregisteredVariants.drawElementCallback = (r, index, isActive, isFocused) =>
|
||||
{
|
||||
if (unregisteredVariants.arraySize <= index) return;
|
||||
|
||||
var element = unregisteredVariants.GetArrayElementAtIndex(index);
|
||||
if (element == null) return;
|
||||
|
||||
var key = element.FindPropertyRelative("key");
|
||||
var value = element.FindPropertyRelative("value");
|
||||
|
||||
var h = EditorGUIUtility.singleLineHeight;
|
||||
var rKey = new Rect(r.x, r.y + 2, r.width, h);
|
||||
EditorGUI.LabelField(rKey, key.stringValue, EditorStyles.popup);
|
||||
|
||||
var rValue = new Rect(r.x + 20, r.y + h + 5, r.width - 40, 14);
|
||||
var keywords = string.IsNullOrEmpty(value.stringValue) ? "<no keywords>" : value.stringValue;
|
||||
EditorGUI.TextField(rValue, GUIContent.none, keywords, "LODRenderersText");
|
||||
|
||||
var rButton = new Rect(r.x + r.width - 20, r.y + h + 4, 20, h);
|
||||
if (GUI.Button(rButton, EditorGUIUtility.IconContent("icons/toolbar plus.png"), "iconbutton"))
|
||||
{
|
||||
var collection = _asset.objectReferenceValue as ShaderVariantCollection;
|
||||
AddVariant(collection, key.stringValue, value.stringValue);
|
||||
unregisteredVariants.DeleteArrayElementAtIndex(index);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
DrawOptionalShaders(ref _expandOptionalShaders, _rlOptionalShaders);
|
||||
if (_rlOptionalShaders != null)
|
||||
{
|
||||
DrawOptionalShaders(ref _expandOptionalShaders, _rlOptionalShaders);
|
||||
}
|
||||
|
||||
DrawRegisteredShaderVariants(ref _expandUnregisteredVariants, _asset, ref _editor);
|
||||
if (0 < _rlUnregisteredVariants.serializedProperty.arraySize)
|
||||
{
|
||||
@@ -386,10 +576,7 @@ namespace Coffee.UIEffectInternal
|
||||
EditorGUILayout.Space(-20);
|
||||
}
|
||||
|
||||
var labelWidth = EditorGUIUtility.labelWidth;
|
||||
EditorGUIUtility.labelWidth = 180;
|
||||
EditorGUILayout.PropertyField(_errorOnUnregisteredVariant);
|
||||
EditorGUIUtility.labelWidth = labelWidth;
|
||||
}
|
||||
|
||||
private static void AddVariant(ShaderVariantCollection collection, string shaderName, string keywords)
|
||||
@@ -397,7 +584,7 @@ namespace Coffee.UIEffectInternal
|
||||
if (collection == null) return;
|
||||
|
||||
var shader = Shader.Find(shaderName);
|
||||
if (!shader) return;
|
||||
if (shader == null) return;
|
||||
|
||||
collection.Add(new ShaderVariantCollection.ShaderVariant
|
||||
{
|
||||
|
||||
@@ -47,12 +47,12 @@ namespace Coffee.UIEffectInternal
|
||||
private static bool HasChanged_Internal(this Transform self, Transform baseTransform, ref Matrix4x4 prev,
|
||||
float epsilon)
|
||||
{
|
||||
if (!self) return false;
|
||||
if (self == null) return false;
|
||||
|
||||
var hash = baseTransform ? baseTransform.GetHashCode() : 0;
|
||||
var hash = baseTransform != null ? baseTransform.GetHashCode() : 0;
|
||||
if (FrameCache.TryGet(self, nameof(HasChanged), hash, out bool result)) return result;
|
||||
|
||||
var matrix = baseTransform
|
||||
var matrix = baseTransform != null
|
||||
? baseTransform.worldToLocalMatrix * self.localToWorldMatrix
|
||||
: self.localToWorldMatrix;
|
||||
var current = matrix * Matrix4x4.Scale(Vector3.one * 10000);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -17,12 +18,6 @@ namespace Coffee.UIEffectInternal
|
||||
private static readonly FastAction s_OnScreenSizeChangedAction = new FastAction();
|
||||
private static Vector2Int s_LastScreenSize;
|
||||
|
||||
static UIExtraCallbacks()
|
||||
{
|
||||
Canvas.willRenderCanvases += OnBeforeCanvasRebuild;
|
||||
Logging.LogMulticast(typeof(Canvas), "willRenderCanvases", message: "ctor");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event that occurs after canvas rebuilds.
|
||||
/// </summary>
|
||||
@@ -67,20 +62,48 @@ namespace Coffee.UIEffectInternal
|
||||
if (s_IsInitializedAfterCanvasRebuild) return;
|
||||
s_IsInitializedAfterCanvasRebuild = true;
|
||||
|
||||
// Explicitly set `Canvas.willRenderCanvases += CanvasUpdateRegistry.PerformUpdate`.
|
||||
CanvasUpdateRegistry.IsRebuildingLayout();
|
||||
#if TMP_ENABLE
|
||||
// Explicitly set `Canvas.willRenderCanvases += TMP_UpdateManager.DoRebuilds`.
|
||||
var property = typeof(TMPro.TMP_UpdateManager)
|
||||
.GetProperty("instance", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
if (property == null)
|
||||
{
|
||||
Debug.LogError("Could not retrieve the TextMeshPro update manager.");
|
||||
}
|
||||
else
|
||||
{
|
||||
var _ = property.GetValue(null);
|
||||
}
|
||||
#endif
|
||||
Canvas.willRenderCanvases -= OnAfterCanvasRebuild;
|
||||
Canvas.willRenderCanvases += OnAfterCanvasRebuild;
|
||||
Logging.LogMulticast(typeof(Canvas), "willRenderCanvases",
|
||||
Logger.LogMulticast(typeof(Canvas), "willRenderCanvases",
|
||||
message: "InitializeAfterCanvasRebuild");
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||
[InitializeOnLoadMethod]
|
||||
#endif
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
#elif UNITY_EDITOR
|
||||
[InitializeOnLoadMethod]
|
||||
#else
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
#endif
|
||||
private static void InitializeOnLoad()
|
||||
{
|
||||
#if UNITY_2019_4 || UNITY_2020_2_OR_NEWER
|
||||
Canvas.preWillRenderCanvases -= OnBeforeCanvasRebuild;
|
||||
Canvas.preWillRenderCanvases += OnBeforeCanvasRebuild;
|
||||
#else
|
||||
Canvas.willRenderCanvases -= OnBeforeCanvasRebuild;
|
||||
Canvas.willRenderCanvases += OnBeforeCanvasRebuild;
|
||||
#endif
|
||||
Canvas.willRenderCanvases -= OnAfterCanvasRebuild;
|
||||
s_IsInitializedAfterCanvasRebuild = false;
|
||||
s_LastScreenSize = default;
|
||||
Logger.LogMulticast(typeof(Canvas), "willRenderCanvases", message: "ctor");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
public Color Get(float time)
|
||||
{
|
||||
return m_Tween
|
||||
? Color.Lerp(m_From, m_Value, m_Curve.Evaluate(time))
|
||||
? Color.Lerp(m_From, m_Value, m_Curve != null ? m_Curve.Evaluate(time) : time)
|
||||
: m_Value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
// #if TIMELINE_ENABLE
|
||||
// using System;
|
||||
// using System.ComponentModel;
|
||||
// using UnityEngine;
|
||||
//
|
||||
// namespace Coffee.UIEffects.Timeline
|
||||
// {
|
||||
// [DisplayName("Clip")]
|
||||
// public class UIEffectFloat01Clip : UIEffectClip<UIEffectFloatBehaviour>
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// // [Serializable]
|
||||
// // public class UIEffectFloat01Behaviour : UIEffectFloatBehaviour
|
||||
// // {
|
||||
// // [Range(0, 1)]
|
||||
// // public float m_Value = 1;
|
||||
// //
|
||||
// // [Range(0, 1)]
|
||||
// // public float m_From = 1;
|
||||
// //
|
||||
// // protected override float from => m_From;
|
||||
// // protected override float value => m_Value;
|
||||
// // }
|
||||
//
|
||||
// // public class UIEffectFloatBehaviour : UIEffectBehaviour, IGetValue<float>
|
||||
// // {
|
||||
// // protected virtual float value { get; }
|
||||
// // protected virtual float from { get; }
|
||||
// //
|
||||
// // public float Get(float time)
|
||||
// // {
|
||||
// // return m_Tween
|
||||
// // ? Mathf.Lerp(from, value, m_Curve.Evaluate(time))
|
||||
// // : value;
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// // public abstract class UIEffectFloatMixerBehaviour : UIEffectMixerBehaviour<float, UIEffectFloatBehaviour>
|
||||
// // {
|
||||
// // protected override float Add(float baseValue, float value, float weight)
|
||||
// // {
|
||||
// // return baseValue + value * weight;
|
||||
// // }
|
||||
// //
|
||||
// // protected override float Lerp(float defaultValue, float value, float weight)
|
||||
// // {
|
||||
// // return Mathf.Lerp(defaultValue, value, weight);
|
||||
// // }
|
||||
// // }
|
||||
// }
|
||||
//
|
||||
// #endif
|
||||
@@ -20,7 +20,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
public float Get(float time)
|
||||
{
|
||||
return m_Tween
|
||||
? Mathf.Lerp(m_From, m_Value, m_Curve.Evaluate(time))
|
||||
? Mathf.Lerp(m_From, m_Value, m_Curve != null ? m_Curve.Evaluate(time) : time)
|
||||
: m_Value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
|
||||
{
|
||||
var trackBinding = director.GetGenericBinding(this) as UIEffect;
|
||||
if (!trackBinding) return;
|
||||
if (trackBinding == null) return;
|
||||
|
||||
driver.AddFromName<UIEffect>(trackBinding.gameObject, fieldName);
|
||||
base.GatherProperties(director, driver);
|
||||
@@ -76,7 +76,6 @@ namespace Coffee.UIEffects.Timeline
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +88,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
|
||||
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
|
||||
{
|
||||
var playable = ScriptPlayable<T>.Create(graph, m_Data);
|
||||
var playable = ScriptPlayable<T>.Create(graph, m_Data ??= new T());
|
||||
var behaviour = playable.GetBehaviour();
|
||||
behaviour.clip = this;
|
||||
return playable;
|
||||
@@ -114,7 +113,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
|
||||
{
|
||||
InitializeIfNeeded(playerData as UIEffect);
|
||||
if (!effect) return;
|
||||
if (effect == null) return;
|
||||
|
||||
var inputCount = playable.GetInputCount();
|
||||
var value = default(T);
|
||||
@@ -127,7 +126,11 @@ namespace Coffee.UIEffects.Timeline
|
||||
|
||||
var playableInput = (ScriptPlayable<TBehavior>)playable.GetInput(i);
|
||||
var input = playableInput.GetBehaviour();
|
||||
var normalizedTime = (float)(playableInput.GetTime() / input.clip.timelineClip.duration);
|
||||
var clip = input != null ? input.clip : null;
|
||||
var timelineClip = clip != null ? clip.timelineClip : null;
|
||||
if (timelineClip == null || timelineClip.duration <= 0) return;
|
||||
|
||||
var normalizedTime = (float)(playableInput.GetTime() / timelineClip.duration);
|
||||
|
||||
value = Add(value, input.Get(normalizedTime), weight / totalWeight);
|
||||
totalWeight += weight;
|
||||
@@ -138,7 +141,7 @@ namespace Coffee.UIEffects.Timeline
|
||||
|
||||
public override void OnPlayableDestroy(Playable playable)
|
||||
{
|
||||
if (effect)
|
||||
if (effect != null)
|
||||
{
|
||||
currentValue = _defaultValue;
|
||||
}
|
||||
@@ -160,13 +163,13 @@ namespace Coffee.UIEffects.Timeline
|
||||
{
|
||||
if (effect == newEffect) return;
|
||||
|
||||
if (effect)
|
||||
if (effect != null)
|
||||
{
|
||||
currentValue = _defaultValue;
|
||||
}
|
||||
|
||||
effect = newEffect;
|
||||
_defaultValue = newEffect ? currentValue : default;
|
||||
_defaultValue = newEffect != null ? currentValue : default;
|
||||
}
|
||||
|
||||
protected abstract T Add(T current, T value, float weight);
|
||||
|
||||
@@ -282,6 +282,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_ToneFilter == value) return;
|
||||
context.m_ToneFilter = m_ToneFilter = value;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -297,7 +298,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_ToneIntensity, value)) return;
|
||||
context.m_ToneIntensity = m_ToneIntensity = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,6 +312,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_ColorFilter == value) return;
|
||||
context.m_ColorFilter = m_ColorFilter = value;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -326,7 +328,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_ColorIntensity, value)) return;
|
||||
context.m_ColorIntensity = m_ColorIntensity = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +340,7 @@ namespace Coffee.UIEffects
|
||||
m_Color.a = 1;
|
||||
if (m_Color == value) return;
|
||||
context.m_Color = m_Color = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,7 +417,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_ColorGlow == value) return;
|
||||
context.m_ColorGlow = m_ColorGlow = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,7 +447,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_SamplingIntensity, value)) return;
|
||||
context.m_SamplingIntensity = m_SamplingIntensity = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,7 +459,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0.5f, 10);
|
||||
if (Mathf.Approximately(m_SamplingWidth, value)) return;
|
||||
context.m_SamplingWidth = m_SamplingWidth = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,7 +505,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_TransitionRate, value)) return;
|
||||
context.m_TransitionRate = m_TransitionRate = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -514,7 +516,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_TransitionReverse == value) return;
|
||||
context.m_TransitionReverse = m_TransitionReverse = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,7 +527,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_TransitionTex == value) return;
|
||||
context.m_TransitionTex = m_TransitionTex = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -536,7 +538,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_TransitionTexScale == value) return;
|
||||
context.m_TransitionTexScale = m_TransitionTexScale = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,7 +549,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_TransitionTexOffset == value) return;
|
||||
context.m_TransitionTexOffset = m_TransitionTexOffset = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -558,7 +560,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_TransitionTexSpeed == value) return;
|
||||
context.m_TransitionTexSpeed = m_TransitionTexSpeed = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -590,7 +592,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_TransitionWidth, value)) return;
|
||||
context.m_TransitionWidth = m_TransitionWidth = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -602,7 +604,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_TransitionSoftness, value)) return;
|
||||
context.m_TransitionSoftness = m_TransitionSoftness = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -613,7 +615,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_TransitionRange.Approximately(value)) return;
|
||||
context.m_TransitionRange = m_TransitionRange = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -635,7 +637,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_TransitionColor == value) return;
|
||||
context.m_TransitionColor = m_TransitionColor = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -712,7 +714,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_TransitionColorGlow == value) return;
|
||||
context.m_TransitionColorGlow = m_TransitionColorGlow = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,7 +725,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_TransitionPatternReverse == value) return;
|
||||
context.m_TransitionPatternReverse = m_TransitionPatternReverse = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -735,7 +737,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, -5, 5);
|
||||
if (Mathf.Approximately(m_TransitionAutoPlaySpeed, value)) return;
|
||||
context.m_TransitionAutoPlaySpeed = m_TransitionAutoPlaySpeed = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -757,7 +759,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_TargetColor == value) return;
|
||||
context.m_TargetColor = m_TargetColor = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -769,7 +771,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_TargetRange, value)) return;
|
||||
context.m_TargetRange = m_TargetRange = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -781,7 +783,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_TargetSoftness, value)) return;
|
||||
context.m_TargetSoftness = m_TargetSoftness = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -794,6 +796,7 @@ namespace Coffee.UIEffects
|
||||
(m_SrcBlendMode, m_DstBlendMode) = (m_BlendType, m_SrcBlendMode, m_DstBlendMode).Convert();
|
||||
context.m_SrcBlendMode = m_SrcBlendMode;
|
||||
context.m_DstBlendMode = m_DstBlendMode;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -810,6 +813,7 @@ namespace Coffee.UIEffects
|
||||
if (m_SrcBlendMode == value) return;
|
||||
context.m_SrcBlendMode = m_SrcBlendMode = value;
|
||||
m_BlendType = (m_SrcBlendMode, m_DstBlendMode).Convert();
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -826,6 +830,7 @@ namespace Coffee.UIEffects
|
||||
if (m_DstBlendMode == value) return;
|
||||
context.m_DstBlendMode = m_DstBlendMode = value;
|
||||
m_BlendType = (m_SrcBlendMode, m_DstBlendMode).Convert();
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -838,6 +843,7 @@ namespace Coffee.UIEffects
|
||||
if (m_ShadowMode == value) return;
|
||||
context.m_ShadowMode = m_ShadowMode = value;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -896,7 +902,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_ShadowBlurIntensity, value)) return;
|
||||
context.m_ShadowBlurIntensity = m_ShadowBlurIntensity = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -918,7 +924,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_ShadowColor == value) return;
|
||||
context.m_ShadowColor = m_ShadowColor = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1002,7 +1008,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_ShadowColorGlow == value) return;
|
||||
context.m_ShadowColorGlow = m_ShadowColorGlow = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1013,6 +1019,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_EdgeMode == value) return;
|
||||
context.m_EdgeMode = m_EdgeMode = value;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -1025,7 +1032,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_EdgeShinyRate, value)) return;
|
||||
context.m_EdgeShinyRate = m_EdgeShinyRate = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1037,7 +1044,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_EdgeWidth, value)) return;
|
||||
context.m_EdgeWidth = m_EdgeWidth = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1059,7 +1066,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_EdgeColor == value) return;
|
||||
context.m_EdgeColor = m_EdgeColor = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1136,7 +1143,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_EdgeColorGlow == value) return;
|
||||
context.m_EdgeColorGlow = m_EdgeColorGlow = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1148,7 +1155,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_EdgeShinyWidth, value)) return;
|
||||
context.m_EdgeShinyWidth = m_EdgeShinyWidth = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1160,7 +1167,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, -5, 5);
|
||||
if (Mathf.Approximately(m_EdgeShinyAutoPlaySpeed, value)) return;
|
||||
context.m_EdgeShinyAutoPlaySpeed = m_EdgeShinyAutoPlaySpeed = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1182,6 +1189,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_GradationMode == value) return;
|
||||
context.m_GradationMode = m_GradationMode = value;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -1197,7 +1205,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_GradationIntensity, value)) return;
|
||||
context.m_GradationIntensity = m_GradationIntensity = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1219,7 +1227,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_GradationColor1 == value) return;
|
||||
context.m_GradationColor1 = m_GradationColor1 = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1230,7 +1238,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_GradationColor2 == value) return;
|
||||
context.m_GradationColor2 = m_GradationColor2 = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1241,7 +1249,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_GradationColor3 == value) return;
|
||||
context.m_GradationColor3 = m_GradationColor3 = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1252,7 +1260,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_GradationColor4 == value) return;
|
||||
context.m_GradationColor4 = m_GradationColor4 = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1263,7 +1271,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (Mathf.Approximately(m_GradationOffset, value)) return;
|
||||
context.m_GradationOffset = m_GradationOffset = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1275,7 +1283,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0.01f, 10f);
|
||||
if (Mathf.Approximately(m_GradationScale, value)) return;
|
||||
context.m_GradationScale = m_GradationScale = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1298,7 +1306,7 @@ namespace Coffee.UIEffects
|
||||
if (m_GradationWrapMode == value) return;
|
||||
context.m_GradationWrapMode = m_GradationWrapMode = value;
|
||||
context.SetGradationDirty();
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1310,7 +1318,7 @@ namespace Coffee.UIEffects
|
||||
if (m_GradationReverse == value) return;
|
||||
context.m_GradationReverse = m_GradationReverse = value;
|
||||
context.SetGradationDirty();
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1321,6 +1329,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_DetailFilter == value) return;
|
||||
context.m_DetailFilter = m_DetailFilter = value;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -1333,7 +1342,7 @@ namespace Coffee.UIEffects
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_DetailIntensity, value)) return;
|
||||
context.m_DetailIntensity = m_DetailIntensity = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1344,18 +1353,18 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_DetailThreshold.Approximately(value)) return;
|
||||
context.m_DetailThreshold = m_DetailThreshold = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public Color detailColor
|
||||
{
|
||||
get => m_EdgeColor;
|
||||
get => m_DetailColor;
|
||||
set
|
||||
{
|
||||
if (m_EdgeColor == value) return;
|
||||
context.m_DetailColor = m_EdgeColor = value;
|
||||
SetMaterialDirty();
|
||||
if (m_DetailColor == value) return;
|
||||
context.m_DetailColor = m_DetailColor = value;
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1377,7 +1386,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_DetailTex == value) return;
|
||||
context.m_DetailTex = m_DetailTex = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1388,7 +1397,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_DetailTexScale == value) return;
|
||||
context.m_DetailTexScale = m_DetailTexScale = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1399,7 +1408,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_DetailTexOffset == value) return;
|
||||
context.m_DetailTexOffset = m_DetailTexOffset = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1410,7 +1419,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_DetailTexSpeed == value) return;
|
||||
context.m_DetailTexSpeed = m_DetailTexSpeed = value;
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1442,7 +1451,7 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
}
|
||||
|
||||
public override RectTransform transitionRoot => m_CustomRoot
|
||||
public override RectTransform transitionRoot => m_CustomRoot != null
|
||||
? m_CustomRoot
|
||||
: transform as RectTransform;
|
||||
|
||||
@@ -1464,6 +1473,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
InternalListPool<UIEffectReplica>.Return(ref _replicas);
|
||||
}
|
||||
|
||||
@@ -1478,14 +1488,16 @@ namespace Coffee.UIEffects
|
||||
|
||||
internal override void SetEnablePreviewIfSelected(GameObject[] selection)
|
||||
{
|
||||
if (selection == null) return;
|
||||
|
||||
var selected = 0 < selection.Length
|
||||
&& (selection.Contains(gameObject)
|
||||
|| replicas.Any(x => x && selection.Contains(x.gameObject)));
|
||||
|| replicas.Any(x => x != null && selection.Contains(x.gameObject)));
|
||||
|
||||
context.SetEnablePreview(selected, effectMaterial);
|
||||
foreach (var r in replicas)
|
||||
{
|
||||
if (!r || !r.isActiveAndEnabled || r.context == null) continue;
|
||||
if (r == null || !r.isActiveAndEnabled || r.context == null) continue;
|
||||
r.context.SetEnablePreview(selected, r.effectMaterial);
|
||||
}
|
||||
}
|
||||
@@ -1494,9 +1506,10 @@ namespace Coffee.UIEffects
|
||||
public override void SetVerticesDirty()
|
||||
{
|
||||
base.SetVerticesDirty();
|
||||
for (var i = 0; i < replicas.Count; i++)
|
||||
var count = replicas.Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
if (!replicas[i]) continue;
|
||||
if (replicas[i] == null) continue;
|
||||
replicas[i].SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
@@ -1504,28 +1517,43 @@ namespace Coffee.UIEffects
|
||||
public override void SetMaterialDirty()
|
||||
{
|
||||
base.SetMaterialDirty();
|
||||
for (var i = 0; i < replicas.Count; i++)
|
||||
var count = replicas.Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
if (!replicas[i]) continue;
|
||||
if (replicas[i] == null) continue;
|
||||
replicas[i].SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetMaterialContextDirty()
|
||||
{
|
||||
base.SetMaterialContextDirty();
|
||||
var count = replicas.Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
if (replicas[i] == null) continue;
|
||||
replicas[i].SetMaterialContextDirty();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set gradation gradient's keys.
|
||||
/// </summary>
|
||||
public void SetGradientKeys(Gradient gradient)
|
||||
{
|
||||
if (gradient == null) return;
|
||||
SetGradientKeys(gradient.colorKeys, gradient.alphaKeys, gradient.mode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get gradation gradient's keys.
|
||||
/// </summary>
|
||||
public void GetGradientKeys(out GradientColorKey[] colorKeys, out GradientAlphaKey[] alphaKeys)
|
||||
public void GetGradientKeys(out GradientColorKey[] colorKeys, out GradientAlphaKey[] alphaKeys,
|
||||
out GradientMode mode)
|
||||
{
|
||||
colorKeys = m_GradationGradient?.colorKeys ?? Array.Empty<GradientColorKey>();
|
||||
alphaKeys = m_GradationGradient?.alphaKeys ?? Array.Empty<GradientAlphaKey>();
|
||||
mode = m_GradationGradient?.mode ?? GradientMode.Blend;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1533,16 +1561,19 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
public void SetTransitionGradientKeys(Gradient gradient)
|
||||
{
|
||||
if (gradient == null) return;
|
||||
SetTransitionGradientKeys(gradient.colorKeys, gradient.alphaKeys, gradient.mode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get transition gradation gradient's keys.
|
||||
/// </summary>
|
||||
public void GetTransitionGradientKeys(out GradientColorKey[] colorKeys, out GradientAlphaKey[] alphaKeys)
|
||||
public void GetTransitionGradientKeys(out GradientColorKey[] colorKeys, out GradientAlphaKey[] alphaKeys,
|
||||
out GradientMode mode)
|
||||
{
|
||||
colorKeys = m_TransitionGradient?.colorKeys ?? Array.Empty<GradientColorKey>();
|
||||
alphaKeys = m_TransitionGradient?.alphaKeys ?? Array.Empty<GradientAlphaKey>();
|
||||
mode = m_TransitionGradient?.mode ?? GradientMode.Blend;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1555,7 +1586,7 @@ namespace Coffee.UIEffects
|
||||
m_GradationGradient.SetKeys(colorKeys, alphaKeys);
|
||||
m_GradationGradient.mode = mode;
|
||||
context?.SetGradationDirty();
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1568,17 +1599,18 @@ namespace Coffee.UIEffects
|
||||
m_TransitionGradient.SetKeys(colorKeys, alphaKeys);
|
||||
m_TransitionGradient.mode = mode;
|
||||
context?.SetTransitionGradationDirty();
|
||||
SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
}
|
||||
|
||||
public override void ApplyContextToMaterial(Material material)
|
||||
{
|
||||
base.ApplyContextToMaterial(material);
|
||||
|
||||
for (var i = 0; i < replicas.Count; i++)
|
||||
var count = replicas.Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
if (!replicas[i]) continue;
|
||||
replicas[i].ApplyContextToMaterial(material);
|
||||
replicas[i].ApplyContextToMaterial(replicas[i].effectMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1689,7 +1721,7 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
public void LoadPreset(UIEffect src, bool append)
|
||||
{
|
||||
if (!src) return;
|
||||
if (src == null) return;
|
||||
|
||||
var dst = this;
|
||||
if (!append || src.m_ToneFilter != ToneFilter.None)
|
||||
@@ -1795,6 +1827,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
if (!append || src.m_DetailFilter != DetailFilter.None)
|
||||
{
|
||||
dst.m_DetailColor = src.m_DetailColor;
|
||||
dst.m_DetailFilter = src.m_DetailFilter;
|
||||
dst.m_DetailIntensity = src.m_DetailIntensity;
|
||||
dst.m_DetailThreshold = src.m_DetailThreshold;
|
||||
@@ -1820,7 +1853,7 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
public void LoadPreset(UIEffectPreset src, bool append)
|
||||
{
|
||||
if (!src) return;
|
||||
if (src == null) return;
|
||||
|
||||
var dst = this;
|
||||
if (!append || src.m_ToneFilter != ToneFilter.None)
|
||||
@@ -1949,7 +1982,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void SavePreset(UIEffectPreset dst, bool append)
|
||||
{
|
||||
if (!dst) return;
|
||||
if (dst == null) return;
|
||||
|
||||
var src = this;
|
||||
if (!append || src.m_ToneFilter != ToneFilter.None)
|
||||
@@ -1992,9 +2025,13 @@ namespace Coffee.UIEffects
|
||||
dst.m_TransitionColorGlow = src.m_TransitionColorGlow;
|
||||
dst.m_TransitionPatternReverse = src.m_TransitionPatternReverse;
|
||||
dst.m_TransitionAutoPlaySpeed = src.m_TransitionAutoPlaySpeed;
|
||||
dst.m_TransitionGradient.SetKeys(src.m_TransitionGradient.colorKeys,
|
||||
src.m_TransitionGradient.alphaKeys);
|
||||
dst.m_TransitionGradient.mode = src.m_TransitionGradient.mode;
|
||||
if (src.m_TransitionGradient != null)
|
||||
{
|
||||
dst.m_TransitionGradient ??= new Gradient();
|
||||
dst.m_TransitionGradient.SetKeys(src.m_TransitionGradient.colorKeys,
|
||||
src.m_TransitionGradient.alphaKeys);
|
||||
dst.m_TransitionGradient.mode = src.m_TransitionGradient.mode;
|
||||
}
|
||||
}
|
||||
|
||||
if (!append || src.m_TargetMode != TargetMode.None)
|
||||
@@ -2047,8 +2084,14 @@ namespace Coffee.UIEffects
|
||||
dst.m_GradationColor2 = src.m_GradationColor2;
|
||||
dst.m_GradationColor3 = src.m_GradationColor3;
|
||||
dst.m_GradationColor4 = src.m_GradationColor4;
|
||||
dst.m_GradationGradient.SetKeys(src.m_GradationGradient.colorKeys, src.m_GradationGradient.alphaKeys);
|
||||
dst.m_GradationGradient.mode = src.m_GradationGradient.mode;
|
||||
if (src.m_GradationGradient != null)
|
||||
{
|
||||
dst.m_GradationGradient ??= new Gradient();
|
||||
dst.m_GradationGradient.SetKeys(src.m_GradationGradient.colorKeys,
|
||||
src.m_GradationGradient.alphaKeys);
|
||||
dst.m_GradationGradient.mode = src.m_GradationGradient.mode;
|
||||
}
|
||||
|
||||
dst.m_GradationOffset = src.m_GradationOffset;
|
||||
dst.m_GradationScale = src.m_GradationScale;
|
||||
dst.m_GradationRotation = src.m_GradationRotation;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Coffee.UIEffects
|
||||
[DisallowMultipleComponent]
|
||||
public abstract class UIEffectBase : UIBehaviour, IMeshModifier, IMaterialModifier, ICanvasRaycastFilter
|
||||
#if TIMELINE_ENABLE
|
||||
,ITimeControl
|
||||
, ITimeControl
|
||||
#endif
|
||||
{
|
||||
private static readonly InternalObjectPool<UIEffectContext> s_ContextPool =
|
||||
@@ -32,13 +32,34 @@ namespace Coffee.UIEffects
|
||||
private Action _onAfterCanvasRebuild;
|
||||
private bool _canModifyMesh;
|
||||
private Matrix4x4 _prevTransformHash;
|
||||
private Canvas _canvas;
|
||||
private bool _canvasCached = false;
|
||||
private bool _isContextDirty;
|
||||
|
||||
public Material effectMaterial => _material;
|
||||
public Graphic graphic => _graphic ? _graphic : _graphic = GetComponent<Graphic>();
|
||||
public virtual uint effectId => (uint)GetInstanceID();
|
||||
public Graphic graphic => _graphic != null ? _graphic : _graphic = GetComponent<Graphic>();
|
||||
public virtual uint effectId => (uint)GetHashCode();
|
||||
public virtual float actualSamplingScale => 1;
|
||||
public virtual bool canModifyShape => true;
|
||||
|
||||
protected Canvas canvas
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_canvasCached) return _canvas;
|
||||
|
||||
_canvasCached = true;
|
||||
_canvas = GetComponentInParent<Canvas>();
|
||||
if (_canvas == null || !_canvas.isActiveAndEnabled)
|
||||
{
|
||||
_canvas = null;
|
||||
_canvasCached = false;
|
||||
}
|
||||
|
||||
return _canvas;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual UIEffectContext context
|
||||
{
|
||||
get
|
||||
@@ -58,10 +79,10 @@ namespace Coffee.UIEffects
|
||||
if (!isActiveAndEnabled) return null;
|
||||
|
||||
var g = graphic;
|
||||
if (!g) return null;
|
||||
if (g == null) return null;
|
||||
|
||||
var canvasRenderer = g.canvasRenderer;
|
||||
if (!canvasRenderer || canvasRenderer.materialCount == 0) return null;
|
||||
if (canvasRenderer == null || canvasRenderer.materialCount == 0) return null;
|
||||
|
||||
return canvasRenderer.GetMaterial();
|
||||
}
|
||||
@@ -104,7 +125,7 @@ namespace Coffee.UIEffects
|
||||
s_ContextPool.Return(ref _context);
|
||||
}
|
||||
|
||||
protected virtual void OnBeforeCanvasRebuild()
|
||||
private void OnBeforeCanvasRebuild()
|
||||
{
|
||||
// If the mesh is not modified in the previous frame, try to modify it if possible.
|
||||
if (!_canModifyMesh && CanModifyMesh())
|
||||
@@ -114,11 +135,33 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnAfterCanvasRebuild()
|
||||
private void OnAfterCanvasRebuild()
|
||||
{
|
||||
if (!_material || !graphic || !graphic.canvas || context == null) return;
|
||||
var g = graphic;
|
||||
var c = canvas;
|
||||
var ctx = context;
|
||||
if (_material == null || g == null || c == null || ctx == null) return;
|
||||
|
||||
context.UpdateViewMatrix(GetCurrentMaterial(), transitionRoot, graphic.canvas.rootCanvas);
|
||||
if (_isContextDirty)
|
||||
{
|
||||
_isContextDirty = false;
|
||||
ApplyContextToMaterial(GetCurrentMaterial());
|
||||
}
|
||||
|
||||
if (!ctx.useViewMatrix) return;
|
||||
|
||||
var material = GetCurrentMaterial();
|
||||
var root = transitionRoot;
|
||||
var rootCanvas = c.rootCanvas;
|
||||
if (material == null || root == null || rootCanvas == null) return;
|
||||
|
||||
ctx.UpdateViewMatrix(material, root, rootCanvas);
|
||||
}
|
||||
|
||||
protected override void OnCanvasHierarchyChanged()
|
||||
{
|
||||
_canvasCached = false;
|
||||
_canvas = null;
|
||||
}
|
||||
|
||||
public void ModifyMesh(Mesh mesh)
|
||||
@@ -127,21 +170,28 @@ namespace Coffee.UIEffects
|
||||
|
||||
public virtual void ModifyMesh(VertexHelper vh)
|
||||
{
|
||||
if (!isActiveAndEnabled || context == null) return;
|
||||
if (!isActiveAndEnabled || vh == null) return;
|
||||
|
||||
var g = graphic;
|
||||
var ctx = context;
|
||||
var root = transitionRoot;
|
||||
if (g == null || ctx == null || root == null) return;
|
||||
|
||||
_canModifyMesh = CanModifyMesh();
|
||||
if (_canModifyMesh)
|
||||
{
|
||||
context.ModifyMesh(graphic, transitionRoot, vh, canModifyShape);
|
||||
ctx.ModifyMesh(g, canvas, root, vh, canModifyShape);
|
||||
}
|
||||
}
|
||||
|
||||
private bool CanModifyMesh()
|
||||
{
|
||||
if (!graphic || !graphic.isActiveAndEnabled) return false;
|
||||
if (graphic == null || !graphic.isActiveAndEnabled) return false;
|
||||
if (!isActiveAndEnabled) return false;
|
||||
|
||||
// The transitionRoot is same as the transform => true.
|
||||
var root = transitionRoot;
|
||||
if (root == null) return false;
|
||||
if (transform == root) return true;
|
||||
|
||||
// The transitionRoot is not visible => false.
|
||||
@@ -160,8 +210,8 @@ namespace Coffee.UIEffects
|
||||
|
||||
Profiler.BeginSample("(UIE)[UIEffect] GetModifiedMaterial");
|
||||
var samplingScaleId = (uint)(Mathf.InverseLerp(0.01f, 100, actualSamplingScale) * uint.MaxValue);
|
||||
var rootId = (uint)(transitionRoot ? transitionRoot.GetInstanceID() : 0);
|
||||
var hash = new Hash128((uint)baseMaterial.GetInstanceID(), effectId, samplingScaleId, rootId);
|
||||
var rootId = (uint)(transitionRoot != null ? transitionRoot.GetHashCode() : 0);
|
||||
var hash = new Hash128((uint)baseMaterial.GetHashCode(), effectId, samplingScaleId, rootId);
|
||||
if (!MaterialRepository.Valid(hash, _material))
|
||||
{
|
||||
Profiler.BeginSample("(UIE)[UIEffect] GetModifiedMaterial > Get or create material");
|
||||
@@ -215,21 +265,27 @@ namespace Coffee.UIEffects
|
||||
|
||||
public virtual void SetVerticesDirty()
|
||||
{
|
||||
if (graphic)
|
||||
{
|
||||
graphic.SetVerticesDirty();
|
||||
GraphicProxy.Find(graphic).SetVerticesDirty(graphic, enabled);
|
||||
Misc.QueuePlayerLoopUpdate();
|
||||
}
|
||||
var g = graphic;
|
||||
if (g == null) return;
|
||||
|
||||
g.SetVerticesDirty();
|
||||
GraphicProxy.Find(g)?.SetVerticesDirty(g, enabled);
|
||||
Misc.QueuePlayerLoopUpdate();
|
||||
}
|
||||
|
||||
public virtual void SetMaterialDirty()
|
||||
{
|
||||
if (graphic)
|
||||
{
|
||||
graphic.SetMaterialDirty();
|
||||
Misc.QueuePlayerLoopUpdate();
|
||||
}
|
||||
var g = graphic;
|
||||
if (g == null) return;
|
||||
|
||||
g.SetMaterialDirty();
|
||||
SetMaterialContextDirty();
|
||||
Misc.QueuePlayerLoopUpdate();
|
||||
}
|
||||
|
||||
public virtual void SetMaterialContextDirty()
|
||||
{
|
||||
_isContextDirty = true;
|
||||
}
|
||||
|
||||
internal void ReleaseMaterial()
|
||||
@@ -241,8 +297,9 @@ namespace Coffee.UIEffects
|
||||
|
||||
public virtual void ApplyContextToMaterial(Material material)
|
||||
{
|
||||
if (!isActiveAndEnabled || context == null || !material) return;
|
||||
if (!isActiveAndEnabled || context == null || material == null) return;
|
||||
|
||||
_isContextDirty = false;
|
||||
context.ApplyToMaterial(material, actualSamplingScale);
|
||||
|
||||
#if UNITY_EDITOR
|
||||
@@ -267,7 +324,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void OnControlTimeStart()
|
||||
{
|
||||
if (this)
|
||||
if (this != null)
|
||||
{
|
||||
enabled = true;
|
||||
}
|
||||
@@ -275,7 +332,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void OnControlTimeStop()
|
||||
{
|
||||
if (this)
|
||||
if (this != null)
|
||||
{
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
public class UIEffectContext
|
||||
public sealed class UIEffectContext
|
||||
{
|
||||
private static readonly UIEffectContext s_DefaultContext = new UIEffectContext();
|
||||
private static readonly List<UIVertex> s_WorkingVertices = new List<UIVertex>(1024 * 8);
|
||||
@@ -258,6 +258,11 @@ namespace Coffee.UIEffects
|
||||
|
||||
public bool willModifyVertex => willModifyMaterial;
|
||||
|
||||
public bool useViewMatrix => m_TransitionFilter != TransitionFilter.None
|
||||
|| m_GradationMode != GradationMode.None
|
||||
|| m_DetailFilter != DetailFilter.None
|
||||
|| m_EdgeMode == EdgeMode.Shiny;
|
||||
|
||||
private Texture2D _gradationRampTex;
|
||||
private Texture2D _transitionRampTex;
|
||||
private bool _isGradientDirty = true;
|
||||
@@ -285,7 +290,7 @@ namespace Coffee.UIEffects
|
||||
get
|
||||
{
|
||||
if (m_GradationGradient == null) return null;
|
||||
if (!_gradationRampTex) _gradationRampTex = s_TexturePool.Rent();
|
||||
if (_gradationRampTex == null) _gradationRampTex = s_TexturePool.Rent();
|
||||
if (!_isGradientDirty) return _gradationRampTex;
|
||||
_isGradientDirty = false;
|
||||
|
||||
@@ -294,7 +299,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
var x = m_GradationReverse ? w - 1 - i : i;
|
||||
var t = (float)i / (w - 1);
|
||||
s_Colors[x] = m_GradationGradient.Evaluate(t);
|
||||
s_Colors[x] = ApplyColorSpace(m_GradationGradient.Evaluate(t));
|
||||
}
|
||||
|
||||
_gradationRampTex.wrapMode = m_GradationWrapMode;
|
||||
@@ -312,7 +317,7 @@ namespace Coffee.UIEffects
|
||||
get
|
||||
{
|
||||
if (m_TransitionGradient == null) return null;
|
||||
if (!_transitionRampTex) _transitionRampTex = s_TexturePool.Rent();
|
||||
if (_transitionRampTex == null) _transitionRampTex = s_TexturePool.Rent();
|
||||
if (!_isTransitionGradientDirty) return _transitionRampTex;
|
||||
_isTransitionGradientDirty = false;
|
||||
|
||||
@@ -320,7 +325,7 @@ namespace Coffee.UIEffects
|
||||
for (var i = 0; i < w; i++)
|
||||
{
|
||||
var t = (float)i / (w - 1);
|
||||
s_Colors[i] = m_TransitionGradient.Evaluate(t);
|
||||
s_Colors[i] = ApplyColorSpace(m_TransitionGradient.Evaluate(t));
|
||||
}
|
||||
|
||||
s_Colors[w - 1].a = 0;
|
||||
@@ -444,9 +449,9 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void ApplyToMaterial(Material material, float actualSamplingScale = 1f)
|
||||
{
|
||||
if (!material) return;
|
||||
if (material == null) return;
|
||||
|
||||
Profiler.BeginSample("(UIE)[UIEffect] GetModifiedMaterial");
|
||||
Profiler.BeginSample("(UIE)[UIEffect] ApplyToMaterial");
|
||||
|
||||
material.SetInt(s_SrcBlend, (int)m_SrcBlendMode);
|
||||
material.SetInt(s_DstBlend, (int)m_DstBlendMode);
|
||||
@@ -454,7 +459,7 @@ namespace Coffee.UIEffects
|
||||
material.SetFloat(s_ToneIntensity, Mathf.Clamp01(m_ToneIntensity));
|
||||
|
||||
material.SetInt(s_ColorFilter, (int)m_ColorFilter);
|
||||
material.SetColor(s_ColorValue, m_Color);
|
||||
material.SetColor(s_ColorValue, ApplyColorSpace(m_Color));
|
||||
material.SetFloat(s_ColorIntensity, Mathf.Clamp01(m_ColorIntensity));
|
||||
material.SetInt(s_ColorGlow, m_ColorGlow ? 1 : 0);
|
||||
|
||||
@@ -473,14 +478,14 @@ namespace Coffee.UIEffects
|
||||
material.SetFloat(s_TransitionSoftness, Mathf.Clamp01(m_TransitionSoftness));
|
||||
material.SetVector(s_TransitionRange, new Vector2(m_TransitionRange.min, m_TransitionRange.max));
|
||||
material.SetInt(s_TransitionColorFilter, (int)m_TransitionColorFilter);
|
||||
material.SetColor(s_TransitionColor, m_TransitionColor);
|
||||
material.SetColor(s_TransitionColor, ApplyColorSpace(m_TransitionColor));
|
||||
material.SetInt(s_TransitionColorGlow, m_TransitionColorGlow ? 1 : 0);
|
||||
material.SetInt(s_TransitionPatternReverse, m_TransitionPatternReverse ? 1 : 0);
|
||||
material.SetFloat(s_TransitionAutoPlaySpeed, m_TransitionAutoPlaySpeed);
|
||||
material.SetTexture(s_TransitionGradientTex,
|
||||
m_TransitionFilter == TransitionFilter.Blaze ? transitionRampTex : null);
|
||||
|
||||
material.SetColor(s_TargetColor, m_TargetColor);
|
||||
material.SetColor(s_TargetColor, ApplyColorSpace(m_TargetColor));
|
||||
material.SetFloat(s_TargetRange, Mathf.Clamp01(m_TargetRange));
|
||||
material.SetFloat(s_TargetSoftness, Mathf.Clamp01(m_TargetSoftness));
|
||||
|
||||
@@ -497,12 +502,12 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
|
||||
material.SetInt(s_ShadowColorFilter, (int)m_ShadowColorFilter);
|
||||
material.SetColor(s_ShadowColor, m_ShadowColor);
|
||||
material.SetColor(s_ShadowColor, ApplyColorSpace(m_ShadowColor));
|
||||
material.SetInt(s_ShadowColorGlow, m_ShadowColorGlow ? 1 : 0);
|
||||
|
||||
material.SetFloat(s_EdgeWidth, Mathf.Clamp01(m_EdgeWidth));
|
||||
material.SetInt(s_EdgeColorFilter, (int)m_EdgeColorFilter);
|
||||
material.SetColor(s_EdgeColor, m_EdgeColor);
|
||||
material.SetColor(s_EdgeColor, ApplyColorSpace(m_EdgeColor));
|
||||
material.SetInt(s_EdgeColorGlow, m_EdgeColorGlow ? 1 : 0);
|
||||
material.SetFloat(s_EdgeShinyRate, Mathf.Clamp01(m_EdgeShinyRate));
|
||||
material.SetFloat(s_EdgeShinyWidth, Mathf.Clamp01(m_EdgeShinyWidth));
|
||||
@@ -514,18 +519,20 @@ namespace Coffee.UIEffects
|
||||
|
||||
material.SetFloat(s_GradationIntensity, m_GradationIntensity);
|
||||
material.SetInt(s_GradationColorFilter, (int)m_GradationColorFilter);
|
||||
material.SetColor(s_GradationColor1, m_GradationColor1);
|
||||
material.SetColor(s_GradationColor2, m_GradationColor2);
|
||||
material.SetColor(s_GradationColor3, m_GradationColor3);
|
||||
material.SetColor(s_GradationColor4, m_GradationColor4);
|
||||
material.SetColor(s_GradationColor1, ApplyColorSpace(m_GradationColor1));
|
||||
material.SetColor(s_GradationColor2, ApplyColorSpace(m_GradationColor2));
|
||||
material.SetColor(s_GradationColor3, ApplyColorSpace(m_GradationColor3));
|
||||
material.SetColor(s_GradationColor4, ApplyColorSpace(m_GradationColor4));
|
||||
material.SetInt(s_GradationRadial, m_GradationMode == GradationMode.Radial
|
||||
#pragma warning disable CS0612 // Type or member is obsolete
|
||||
|| m_GradationMode == GradationMode.RadialDetail
|
||||
#pragma warning restore CS0612
|
||||
|| m_GradationMode == GradationMode.RadialGradient ? 1 : 0);
|
||||
|| m_GradationMode == GradationMode.RadialGradient
|
||||
? 1
|
||||
: 0);
|
||||
|
||||
material.SetFloat(s_DetailIntensity, Mathf.Clamp01(m_DetailIntensity));
|
||||
material.SetColor(s_DetailColor, m_DetailColor);
|
||||
material.SetColor(s_DetailColor, ApplyColorSpace(m_DetailColor));
|
||||
material.SetVector(s_DetailThreshold, new Vector2(m_DetailThreshold.min, m_DetailThreshold.max));
|
||||
material.SetTexture(s_DetailTex, m_DetailFilter != 0 ? m_DetailTex : null);
|
||||
material.SetVector(s_DetailTex_ST,
|
||||
@@ -573,7 +580,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void SetEnablePreview(bool enable, Material material)
|
||||
{
|
||||
if (!material) return;
|
||||
if (material == null) return;
|
||||
material.SetVector(s_TransitionTex_Speed, enable ? (Vector4)m_TransitionTexSpeed : Vector4.zero);
|
||||
material.SetVector(s_DetailTex_Speed, enable ? (Vector4)m_DetailTexSpeed : Vector4.zero);
|
||||
material.SetFloat(s_TransitionAutoPlaySpeed, enable ? m_TransitionAutoPlaySpeed : 0);
|
||||
@@ -582,7 +589,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void UpdateViewMatrix(Material material, RectTransform transitionRoot, Canvas canvas)
|
||||
{
|
||||
if (!material) return;
|
||||
if (material == null || transitionRoot == null || canvas == null) return;
|
||||
|
||||
var size = transitionRoot.rect.size;
|
||||
var scale = new Vector3(1f / size.x, 1f / size.y, 1f);
|
||||
@@ -597,16 +604,17 @@ namespace Coffee.UIEffects
|
||||
scale.y = 0 != (m_Flip & Flip.Vertical) ? -scale.y : scale.y;
|
||||
}
|
||||
|
||||
var pivot = new Vector2(0.5f, 0.5f);
|
||||
var offset = (transitionRoot.pivot - pivot) * size;
|
||||
var pivot = new Vector3(0.5f, 0.5f);
|
||||
var offset = (transitionRoot.pivot - (Vector2)pivot) * size;
|
||||
var w2LMat = Matrix4x4.Translate(offset) * transitionRoot.worldToLocalMatrix;
|
||||
|
||||
var rootRotation = Quaternion.Euler(0, 0, m_TransitionRotation);
|
||||
var rootScale = 1f / GetMultiplier(m_TransitionRotation);
|
||||
material.SetMatrix(s_RootViewMatrix, Matrix4x4.TRS(pivot, rootRotation, scale * rootScale) * w2LMat);
|
||||
|
||||
var gradRotation = Quaternion.Euler(0, 0, GetGradationRotation());
|
||||
var gradScale = 1f / GetMultiplier(GetGradationRotation());
|
||||
var rotation = GetGradationRotation();
|
||||
var gradRotation = Quaternion.Euler(0, 0, rotation);
|
||||
var gradScale = 1f / GetMultiplier(rotation);
|
||||
material.SetMatrix(s_GradViewMatrix, Matrix4x4.TRS(pivot, gradRotation, scale * gradScale) * w2LMat);
|
||||
|
||||
if (m_ShadowMode == ShadowMode.Mirror)
|
||||
@@ -615,26 +623,25 @@ namespace Coffee.UIEffects
|
||||
var mirrorOffset = new Vector3(0, size.y / 2 * (mirrorInv + 1) - m_ShadowDistance.y * mirrorInv, 0);
|
||||
var mirrorScale = new Vector3(1, mirrorInv, 1);
|
||||
var udScale = new Vector3(scale.x, -scale.y, scale.z);
|
||||
material.SetMatrix(s_MirrorRootViewMatrix,
|
||||
Matrix4x4.TRS(pivot, rootRotation, udScale * rootScale)
|
||||
* Matrix4x4.TRS(mirrorOffset, Quaternion.identity, mirrorScale) * w2LMat);
|
||||
material.SetMatrix(s_MirrorGradViewMatrix,
|
||||
Matrix4x4.TRS(pivot, gradRotation, udScale * gradScale)
|
||||
* Matrix4x4.TRS(mirrorOffset, Quaternion.identity, mirrorScale) * w2LMat);
|
||||
var mirrorTranslation = Matrix4x4.TRS(mirrorOffset, Quaternion.identity, mirrorScale) * w2LMat;
|
||||
material.SetMatrix(
|
||||
s_MirrorRootViewMatrix,
|
||||
Matrix4x4.TRS(pivot, rootRotation, udScale * rootScale) * mirrorTranslation
|
||||
);
|
||||
material.SetMatrix(
|
||||
s_MirrorGradViewMatrix,
|
||||
Matrix4x4.TRS(pivot, gradRotation, udScale * gradScale) * mirrorTranslation
|
||||
);
|
||||
}
|
||||
|
||||
if (canvas.renderMode == RenderMode.WorldSpace)
|
||||
{
|
||||
material.SetMatrix(s_CanvasToWorldMatrix, Matrix4x4.identity);
|
||||
}
|
||||
else if (canvas.renderMode == RenderMode.ScreenSpaceOverlay || !canvas.worldCamera)
|
||||
{
|
||||
material.SetMatrix(s_CanvasToWorldMatrix, canvas.transform.localToWorldMatrix);
|
||||
}
|
||||
else
|
||||
{
|
||||
material.SetMatrix(s_CanvasToWorldMatrix, Matrix4x4.identity);
|
||||
}
|
||||
var useIdentity =
|
||||
canvas.renderMode == RenderMode.WorldSpace ||
|
||||
(canvas.renderMode != RenderMode.ScreenSpaceOverlay && canvas.worldCamera);
|
||||
|
||||
material.SetMatrix(
|
||||
s_CanvasToWorldMatrix,
|
||||
useIdentity ? Matrix4x4.identity : canvas.transform.localToWorldMatrix
|
||||
);
|
||||
}
|
||||
|
||||
private Vector4 GetGradationScaleAndOffset()
|
||||
@@ -686,23 +693,30 @@ namespace Coffee.UIEffects
|
||||
return Mathf.Max(Mathf.Abs(cos - sin), Mathf.Abs(cos + sin));
|
||||
}
|
||||
|
||||
#if UNITY_2021_2_OR_NEWER
|
||||
private static void SetKeyword(Material material, Span<string> keywords, int index)
|
||||
#else
|
||||
private static void SetKeyword(Material material, string[] keywords, int index)
|
||||
#endif
|
||||
{
|
||||
for (var i = 0; i < keywords.Length; i++)
|
||||
var length = keywords.Length;
|
||||
if (index < length && !string.IsNullOrEmpty(keywords[index]))
|
||||
{
|
||||
if (i != index)
|
||||
{
|
||||
material.DisableKeyword(keywords[i]);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(keywords[i]))
|
||||
{
|
||||
material.EnableKeyword(keywords[i]);
|
||||
}
|
||||
material.EnableKeyword(keywords[index]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < length; i++)
|
||||
{
|
||||
if (i == index) continue;
|
||||
material.DisableKeyword(keywords[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void ModifyMesh(Graphic graphic, RectTransform transitionRoot, VertexHelper vh, bool canModifyShape)
|
||||
public void ModifyMesh(Graphic graphic, Canvas canvas, RectTransform transitionRoot, VertexHelper vh,
|
||||
bool canModifyShape)
|
||||
{
|
||||
if (graphic == null || transitionRoot == null || vh == null) return;
|
||||
|
||||
// Apply flip (without effect).
|
||||
ApplyFlipWithoutEffect(vh, m_Flip);
|
||||
|
||||
@@ -710,8 +724,9 @@ namespace Coffee.UIEffects
|
||||
if (!willModifyVertex || count == 0) return;
|
||||
|
||||
var effectProxy = GraphicProxy.Find(graphic);
|
||||
if (effectProxy == null) return;
|
||||
var isText = effectProxy.IsText(graphic);
|
||||
effectProxy.OnPreModifyMesh(graphic);
|
||||
effectProxy.OnPreModifyMesh(graphic, canvas);
|
||||
|
||||
var verts = s_WorkingVertices;
|
||||
var expandSize = effectProxy.ModifyExpandSize(graphic, GetExpandSize(canModifyShape));
|
||||
@@ -834,5 +849,10 @@ namespace Coffee.UIEffects
|
||||
|
||||
return expandSize;
|
||||
}
|
||||
|
||||
private static Color ApplyColorSpace(Color color)
|
||||
{
|
||||
return QualitySettings.activeColorSpace == ColorSpace.Linear ? color : color.gamma;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,24 @@ namespace Coffee.UIEffects
|
||||
[ExecuteAlways]
|
||||
public class UIEffectPreset : ScriptableObject
|
||||
{
|
||||
internal static UIEffectPreset s_DefaultPreset;
|
||||
private static UIEffectPreset s_DefaultPreset;
|
||||
|
||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void OnDomainReload()
|
||||
{
|
||||
if (s_DefaultPreset != null)
|
||||
{
|
||||
Misc.DestroyImmediate(s_DefaultPreset);
|
||||
}
|
||||
|
||||
s_DefaultPreset = null;
|
||||
}
|
||||
#endif
|
||||
|
||||
internal static UIEffectPreset GetDefaultPreset()
|
||||
{
|
||||
if (!s_DefaultPreset)
|
||||
if (s_DefaultPreset == null)
|
||||
{
|
||||
s_DefaultPreset = CreateInstance<UIEffectPreset>();
|
||||
s_DefaultPreset.hideFlags = HideFlags.HideAndDontSave;
|
||||
@@ -108,6 +121,8 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void UpdateContext(UIEffectContext dst)
|
||||
{
|
||||
if (dst == null) return;
|
||||
|
||||
var src = this;
|
||||
dst.m_ToneFilter = src.m_ToneFilter;
|
||||
dst.m_ToneIntensity = src.m_ToneIntensity;
|
||||
|
||||
@@ -13,15 +13,17 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
public class UIEffectProjectSettings : PreloadedProjectSettings<UIEffectProjectSettings>
|
||||
{
|
||||
[Header("Setting")]
|
||||
[HideInInspector]
|
||||
[SerializeField]
|
||||
internal List<UIEffect> m_RuntimePresets = new List<UIEffect>();
|
||||
|
||||
[HideInInspector]
|
||||
[SerializeField]
|
||||
internal List<UIEffectPreset> m_RuntimePresetsV2 = new List<UIEffectPreset>();
|
||||
|
||||
[Header("Editor")]
|
||||
[Tooltip("Use HDR color pickers on color fields.")]
|
||||
[HideInInspector]
|
||||
[SerializeField] private bool m_UseHDRColorPicker = true;
|
||||
|
||||
[HideInInspector]
|
||||
@@ -45,7 +47,7 @@ namespace Coffee.UIEffects
|
||||
public static void RegisterRuntimePreset(UIEffectPreset preset)
|
||||
{
|
||||
// Already registered.
|
||||
if (!preset || instance.m_RuntimePresetsV2.Contains(preset)) return;
|
||||
if (preset == null || instance.m_RuntimePresetsV2.Contains(preset)) return;
|
||||
|
||||
instance.m_RuntimePresetsV2.Add(preset);
|
||||
#if UNITY_EDITOR
|
||||
@@ -59,7 +61,7 @@ namespace Coffee.UIEffects
|
||||
for (var i = 0; i < instance.m_RuntimePresets.Count; i++)
|
||||
{
|
||||
var preset = instance.m_RuntimePresets[i];
|
||||
if (preset && preset.name == presetName)
|
||||
if (preset != null && preset.name == presetName)
|
||||
{
|
||||
return preset;
|
||||
}
|
||||
@@ -73,7 +75,7 @@ namespace Coffee.UIEffects
|
||||
for (var i = 0; i < instance.m_RuntimePresetsV2.Count; i++)
|
||||
{
|
||||
var preset = instance.m_RuntimePresetsV2[i];
|
||||
if (preset && preset.name == presetName)
|
||||
if (preset != null && preset.name == presetName)
|
||||
{
|
||||
return preset;
|
||||
}
|
||||
@@ -83,6 +85,14 @@ namespace Coffee.UIEffects
|
||||
#pragma warning restore CS0618
|
||||
}
|
||||
|
||||
#if !UNITY_EDITOR
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_ShaderVariantRegistry.InitializeShaderLookup();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private const string k_PresetDir = "UIEffectPresets";
|
||||
private const string k_PresetSaveDir = "Assets/ProjectSettings/" + k_PresetDir;
|
||||
@@ -93,11 +103,12 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
#if !LEGACY_TMP_ENABLE
|
||||
const string tmpSupport = "TextMeshPro Support (Unity 6)";
|
||||
const string version = "v5.9.0 (Unity 6)";
|
||||
const string version = "v5.11.0 (Unity 6)";
|
||||
#else
|
||||
const string tmpSupport = "TextMeshPro Support";
|
||||
const string version = "v5.9.0";
|
||||
const string version = "v5.11.0";
|
||||
#endif
|
||||
ShaderSampleImporter.RegisterReadmeUrl("https://github.com/mob-sakai/UIEffect#import-additional-resources");
|
||||
ShaderSampleImporter.RegisterShaderSamples(new[]
|
||||
{
|
||||
// TextMeshPro Support/TextMeshPro Support (Unity 6)
|
||||
@@ -111,8 +122,8 @@ namespace Coffee.UIEffects
|
||||
("Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)", tmpSupport, version),
|
||||
|
||||
// ShaderGraph Support
|
||||
("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.9.0"),
|
||||
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.9.0")
|
||||
("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.11.0"),
|
||||
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.11.0")
|
||||
});
|
||||
ShaderSampleImporter.RegisterShaderAliases(new[]
|
||||
{
|
||||
@@ -191,6 +202,15 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh all UI Graphics in the opened scenes. (#376)
|
||||
EditorApplication.delayCall += () =>
|
||||
{
|
||||
foreach (var g in Misc.FindObjectsOfType<UnityEngine.UI.Graphic>())
|
||||
{
|
||||
g.SetAllDirty();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,6 +225,7 @@ namespace Coffee.UIEffects
|
||||
base.OnEnable();
|
||||
m_ShaderVariantRegistry.onShaderRequested = ShaderSampleImporter.ImportShaderIfSelected;
|
||||
m_ShaderVariantRegistry.ClearCache();
|
||||
m_ShaderVariantRegistry.InitializeShaderLookup();
|
||||
}
|
||||
|
||||
protected override void OnCreateAsset()
|
||||
|
||||
@@ -99,33 +99,53 @@ namespace Coffee.UIEffects
|
||||
|
||||
public override bool canModifyShape => m_AllowToModifyMeshShape;
|
||||
|
||||
public override uint effectId => target ? target.effectId : 0;
|
||||
public override uint effectId => target != null
|
||||
? target.effectId
|
||||
: preset != null
|
||||
? (uint)preset.GetHashCode()
|
||||
: (uint)GetHashCode();
|
||||
|
||||
|
||||
public override UIEffectContext context
|
||||
{
|
||||
get
|
||||
{
|
||||
// Following the preset/preset-target.
|
||||
if (preset || (target && !isTargetInScene)) return base.context;
|
||||
if (preset != null || (target != null && !isTargetInScene)) return base.context;
|
||||
|
||||
// Following the instantiated target.
|
||||
return target && target.isActiveAndEnabled && isTargetInScene
|
||||
return target != null && target.isActiveAndEnabled && isTargetInScene
|
||||
? target.context
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
public override RectTransform transitionRoot => useTargetTransform && isTargetInScene
|
||||
? target.transitionRoot
|
||||
: m_CustomRoot
|
||||
? m_CustomRoot
|
||||
: transform as RectTransform;
|
||||
public override RectTransform transitionRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
if (useTargetTransform)
|
||||
{
|
||||
if (preset != null && m_CustomRoot == null && graphic != null && canvas != null)
|
||||
{
|
||||
return canvas.transform as RectTransform;
|
||||
}
|
||||
|
||||
private bool isTargetInScene => target && target.gameObject.scene.IsValid();
|
||||
if (isTargetInScene)
|
||||
{
|
||||
return target.transitionRoot;
|
||||
}
|
||||
}
|
||||
|
||||
return m_CustomRoot != null ? m_CustomRoot : transform as RectTransform;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isTargetInScene => target != null && target.gameObject.scene.IsValid();
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
if (!preset)
|
||||
if (preset == null)
|
||||
{
|
||||
RefreshTarget(target);
|
||||
}
|
||||
@@ -150,7 +170,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
RefreshTarget(target);
|
||||
|
||||
if (preset || (target && !isTargetInScene))
|
||||
if (preset != null || (target != null && !isTargetInScene))
|
||||
{
|
||||
context?.SetGradationDirty();
|
||||
context?.SetTransitionGradationDirty();
|
||||
@@ -167,9 +187,9 @@ namespace Coffee.UIEffects
|
||||
target.SetEnablePreviewIfSelected(selection);
|
||||
}
|
||||
// Following the preset/preset-target.
|
||||
else if (context != null)
|
||||
else
|
||||
{
|
||||
context.SetEnablePreview(selection.Contains(gameObject), effectMaterial);
|
||||
context?.SetEnablePreview(selection.Contains(gameObject), effectMaterial);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -177,12 +197,12 @@ namespace Coffee.UIEffects
|
||||
private void RefreshTarget(UIEffect newTarget)
|
||||
{
|
||||
if (_currentTarget == newTarget) return;
|
||||
if (_currentTarget)
|
||||
if (_currentTarget != null)
|
||||
{
|
||||
_currentTarget.replicas.Remove(this);
|
||||
}
|
||||
|
||||
if (newTarget)
|
||||
if (newTarget != null)
|
||||
{
|
||||
_currentTarget = newTarget;
|
||||
if (isTargetInScene)
|
||||
@@ -199,12 +219,12 @@ namespace Coffee.UIEffects
|
||||
internal override void UpdateContext(UIEffectContext dst)
|
||||
{
|
||||
// Following the preset.
|
||||
if (preset)
|
||||
if (preset != null)
|
||||
{
|
||||
preset.UpdateContext(dst);
|
||||
}
|
||||
// Following the preset-target.
|
||||
else if (target && !isTargetInScene)
|
||||
else if (target != null && !isTargetInScene)
|
||||
{
|
||||
target.UpdateContext(dst);
|
||||
}
|
||||
@@ -212,10 +232,10 @@ namespace Coffee.UIEffects
|
||||
|
||||
public override void ApplyContextToMaterial(Material material)
|
||||
{
|
||||
if (!isActiveAndEnabled && !preset && !target) return;
|
||||
if (!isActiveAndEnabled && preset == null && target == null) return;
|
||||
|
||||
// Following the preset/preset-target.
|
||||
if (preset || (target && !isTargetInScene))
|
||||
if (preset != null || (target != null && !isTargetInScene))
|
||||
{
|
||||
base.ApplyContextToMaterial(material);
|
||||
}
|
||||
@@ -244,14 +264,42 @@ namespace Coffee.UIEffects
|
||||
|
||||
public void OnAfterDeserialize()
|
||||
{
|
||||
if (m_Preset)
|
||||
if (m_Preset != null)
|
||||
{
|
||||
m_Target = null;
|
||||
}
|
||||
else if (m_Target)
|
||||
else if (m_Target != null)
|
||||
{
|
||||
m_Preset = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTarget(UIEffectBase effect)
|
||||
{
|
||||
if (effect is UIEffect pEffect)
|
||||
{
|
||||
target = pEffect;
|
||||
preset = null;
|
||||
useTargetTransform = true;
|
||||
customRoot = null;
|
||||
samplingScale = pEffect.samplingScale;
|
||||
}
|
||||
else if (effect is UIEffectReplica pReplica)
|
||||
{
|
||||
target = pReplica.target;
|
||||
preset = pReplica.preset;
|
||||
useTargetTransform = pReplica.useTargetTransform;
|
||||
customRoot = pReplica.customRoot;
|
||||
samplingScale = pReplica.samplingScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
target = null;
|
||||
preset = null;
|
||||
useTargetTransform = true;
|
||||
customRoot = null;
|
||||
samplingScale = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Coffee.UIEffectInternal;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
@@ -94,7 +93,6 @@ namespace Coffee.UIEffects
|
||||
[Range(0f, 10)]
|
||||
private float m_Interval;
|
||||
|
||||
[FormerlySerializedAs("m_ResetTimeOnEnable")]
|
||||
[Tooltip("Play the tween when the component is enabled.")]
|
||||
[SerializeField]
|
||||
private PlayOnEnable m_PlayOnEnable = PlayOnEnable.Forward;
|
||||
@@ -134,7 +132,7 @@ namespace Coffee.UIEffects
|
||||
/// <summary>
|
||||
/// The target UIMaterialPropertyInjector to tween.
|
||||
/// </summary>
|
||||
private UIEffectBase target => _target ? _target : _target = GetComponent<UIEffectBase>();
|
||||
private UIEffectBase target => _target != null ? _target : _target = GetComponent<UIEffectBase>();
|
||||
|
||||
/// <summary>
|
||||
/// The culling mask of the tween.
|
||||
@@ -167,7 +165,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
_rate = value;
|
||||
|
||||
if (!target || cullingMask == 0) return;
|
||||
if (target == null || cullingMask == 0) return;
|
||||
|
||||
var currentCurve = curve;
|
||||
if (separateReverseCurve)
|
||||
@@ -315,7 +313,7 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
public AnimationCurve curve
|
||||
{
|
||||
get => m_Curve;
|
||||
get => m_Curve ??= AnimationCurve.Linear(0, 0, 1, 1);
|
||||
set => m_Curve = value;
|
||||
}
|
||||
|
||||
@@ -327,19 +325,19 @@ namespace Coffee.UIEffects
|
||||
|
||||
public AnimationCurve reverseCurve
|
||||
{
|
||||
get => m_ReverseCurve;
|
||||
get => m_ReverseCurve ??= AnimationCurve.Linear(0, 0, 1, 1);
|
||||
set => m_ReverseCurve = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event to invoke when the tween has completed.
|
||||
/// </summary>
|
||||
public UnityEvent onComplete => m_OnComplete;
|
||||
public UnityEvent onComplete => m_OnComplete ??= new UnityEvent();
|
||||
|
||||
/// <summary>
|
||||
/// Event to invoke when the rate was changed.
|
||||
/// </summary>
|
||||
public TweenerEvent onChangedRate => m_OnChangedRate;
|
||||
public TweenerEvent onChangedRate => m_OnChangedRate ??= new TweenerEvent();
|
||||
|
||||
/// <summary>
|
||||
/// Is the tween playing?
|
||||
@@ -423,7 +421,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
if (!isTweening)
|
||||
{
|
||||
m_OnComplete.Invoke();
|
||||
onComplete.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,7 +442,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
if (!isTweening)
|
||||
{
|
||||
m_OnComplete.Invoke();
|
||||
onComplete.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,7 +463,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
if (!isTweening)
|
||||
{
|
||||
m_OnComplete.Invoke();
|
||||
onComplete.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,7 +540,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
if (prevTweening && !isTweening)
|
||||
{
|
||||
m_OnComplete.Invoke();
|
||||
onComplete.Invoke();
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -576,7 +574,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
if (prevTweening && !isTweening)
|
||||
{
|
||||
m_OnComplete.Invoke();
|
||||
onComplete.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,13 @@ namespace Coffee.UIEffects
|
||||
|
||||
public static void Register(GraphicProxy proxy)
|
||||
{
|
||||
if (proxy == null) throw new ArgumentNullException(nameof(proxy));
|
||||
|
||||
// Register only once.
|
||||
foreach (var p in s_Proxies)
|
||||
var count = s_Proxies.Count;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var p = s_Proxies[i];
|
||||
if (p.GetType() == proxy.GetType()) return;
|
||||
}
|
||||
|
||||
@@ -25,9 +29,10 @@ namespace Coffee.UIEffects
|
||||
|
||||
public static GraphicProxy Find(Graphic graphic)
|
||||
{
|
||||
if (!graphic) return null;
|
||||
if (graphic == null) return null;
|
||||
|
||||
for (var i = s_Proxies.Count - 1; i >= 0; i--)
|
||||
var count = s_Proxies.Count;
|
||||
for (var i = count - 1; i >= 0; i--)
|
||||
{
|
||||
var p = s_Proxies[i];
|
||||
if (p.IsValid(graphic)) return p;
|
||||
@@ -41,7 +46,7 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
protected virtual bool IsValid(Graphic graphic)
|
||||
{
|
||||
return graphic;
|
||||
return graphic != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -55,14 +60,13 @@ namespace Coffee.UIEffects
|
||||
/// <summary>
|
||||
/// Called before modifying the mesh.
|
||||
/// </summary>
|
||||
public virtual void OnPreModifyMesh(Graphic graphic)
|
||||
public virtual void OnPreModifyMesh(Graphic graphic, Canvas canvas)
|
||||
{
|
||||
UIVertexUtil.onLerpVertex = s_OnLerpVertex;
|
||||
ShadowUtil.onMarkAsShadow = s_OnMarkAsShadow;
|
||||
UIEffectContext.onModifyVertex = s_OnModifyVertex;
|
||||
|
||||
var canvas = graphic.canvas;
|
||||
if (canvas)
|
||||
if (canvas != null)
|
||||
{
|
||||
canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord1;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
internal class ImageProxy : GraphicProxy
|
||||
internal sealed class ImageProxy : GraphicProxy
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[InitializeOnLoadMethod]
|
||||
@@ -20,7 +20,7 @@ namespace Coffee.UIEffects
|
||||
/// </summary>
|
||||
protected override bool IsValid(Graphic graphic)
|
||||
{
|
||||
if (!graphic) return false;
|
||||
if (graphic == null) return false;
|
||||
if (graphic is Image) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -10,19 +10,19 @@ using Object = UnityEngine.Object;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
internal class TmpProxy : GraphicProxy
|
||||
internal sealed class TmpProxy : GraphicProxy
|
||||
{
|
||||
/// <summary>
|
||||
/// Check if the graphic is valid for this proxy.
|
||||
/// </summary>
|
||||
protected override bool IsValid(Graphic graphic)
|
||||
{
|
||||
if (!graphic) return false;
|
||||
if (graphic == null) return false;
|
||||
if (graphic is TextMeshProUGUI) return true;
|
||||
if (graphic is TMP_SubMeshUI sub)
|
||||
{
|
||||
// If TMP_SubMeshUI is used for text
|
||||
return !sub.spriteAsset
|
||||
return sub.spriteAsset == null
|
||||
|| sub.sharedMaterial != sub.spriteAsset.material;
|
||||
}
|
||||
|
||||
@@ -40,14 +40,13 @@ namespace Coffee.UIEffects
|
||||
/// <summary>
|
||||
/// Called before modifying the mesh.
|
||||
/// </summary>
|
||||
public override void OnPreModifyMesh(Graphic graphic)
|
||||
public override void OnPreModifyMesh(Graphic graphic, Canvas canvas)
|
||||
{
|
||||
UIVertexUtil.onLerpVertex = s_OnLerpVertex;
|
||||
ShadowUtil.onMarkAsShadow = s_OnMarkAsShadow;
|
||||
UIEffectContext.onModifyVertex = s_OnModifyVertex;
|
||||
|
||||
var canvas = graphic.canvas;
|
||||
if (canvas)
|
||||
if (canvas != null)
|
||||
{
|
||||
canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord2;
|
||||
}
|
||||
@@ -131,7 +130,10 @@ namespace Coffee.UIEffects
|
||||
// When the text is changed, add it to the changed list
|
||||
TMPro_EventManager.TEXT_CHANGED_EVENT.Add(obj =>
|
||||
{
|
||||
if (obj is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
|
||||
if (obj is TextMeshProUGUI textMeshProUGUI
|
||||
&& textMeshProUGUI.isActiveAndEnabled
|
||||
// fix: `TmpProxy` causes loss of modifications from other `IMeshModifiers` (#371)
|
||||
&& textMeshProUGUI.TryGetComponent<UIEffectBase>(out var _))
|
||||
{
|
||||
s_ChangedInstances.Add(textMeshProUGUI);
|
||||
}
|
||||
@@ -143,7 +145,9 @@ namespace Coffee.UIEffects
|
||||
var toRemove = InternalListPool<TextMeshProUGUI>.Rent();
|
||||
foreach (var textMeshProUGUI in s_RegisteredInstances)
|
||||
{
|
||||
if (textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
|
||||
if (textMeshProUGUI != null
|
||||
&& textMeshProUGUI.isActiveAndEnabled
|
||||
&& !textMeshProUGUI.isTextObjectScaleStatic)
|
||||
{
|
||||
var id = textMeshProUGUI.GetHashCode();
|
||||
var lossyScaleY = textMeshProUGUI.transform.lossyScale.y;
|
||||
@@ -179,7 +183,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
foreach (var textMeshProUGUI in s_ChangedInstances)
|
||||
{
|
||||
if (!textMeshProUGUI || !textMeshProUGUI.isActiveAndEnabled) continue;
|
||||
if (textMeshProUGUI == null || !textMeshProUGUI.isActiveAndEnabled) continue;
|
||||
if (!textMeshProUGUI.TryGetComponent<IMeshModifier>(out var _)) continue;
|
||||
|
||||
s_RegisteredInstances.Add(textMeshProUGUI);
|
||||
@@ -194,7 +198,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
foreach (var textMeshProUGUI in s_RegisteredInstances)
|
||||
{
|
||||
if (!textMeshProUGUI || !textMeshProUGUI.isActiveAndEnabled) continue;
|
||||
if (textMeshProUGUI == null || !textMeshProUGUI.isActiveAndEnabled) continue;
|
||||
if (textMeshProUGUI.TryGetComponent<UIEffectBase>(out var effect) && effect.isActiveAndEnabled)
|
||||
{
|
||||
effect.ReleaseMaterial();
|
||||
@@ -209,7 +213,13 @@ namespace Coffee.UIEffects
|
||||
|
||||
private static void ModifyMesh(TextMeshProUGUI textMeshProUGUI)
|
||||
{
|
||||
if (!s_Mesh)
|
||||
if (!textMeshProUGUI || !textMeshProUGUI.isActiveAndEnabled) return;
|
||||
if (textMeshProUGUI.textInfo == null || textMeshProUGUI.textInfo.meshInfo == null) return;
|
||||
|
||||
var canvasRenderer = textMeshProUGUI.canvasRenderer;
|
||||
if (canvasRenderer == null) return;
|
||||
|
||||
if (s_Mesh == null)
|
||||
{
|
||||
s_Mesh = new Mesh();
|
||||
s_Mesh.MarkDynamic();
|
||||
@@ -225,10 +235,23 @@ namespace Coffee.UIEffects
|
||||
for (var i = 0; i < textMeshProUGUI.textInfo.meshInfo.Length; i++)
|
||||
{
|
||||
var meshInfo = textMeshProUGUI.textInfo.meshInfo[i];
|
||||
if (meshInfo.vertexCount == 0)
|
||||
if (meshInfo.vertexCount == 0 || meshInfo.mesh == null)
|
||||
{
|
||||
// Clear mesh if no vertices.
|
||||
s_Mesh.Clear(false);
|
||||
textMeshProUGUI.canvasRenderer.SetMesh(s_Mesh);
|
||||
if (i == 0)
|
||||
{
|
||||
canvasRenderer.SetMesh(s_Mesh);
|
||||
}
|
||||
else
|
||||
{
|
||||
var subMeshUI = GetSubMeshUI(subMeshes, meshInfo.material, meshInfo.mesh, i - 1);
|
||||
if (subMeshUI != null && subMeshUI.canvasRenderer != null)
|
||||
{
|
||||
subMeshUI.canvasRenderer.SetMesh(s_Mesh);
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -242,7 +265,7 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
|
||||
s_VertexHelper.FillMesh(s_Mesh);
|
||||
textMeshProUGUI.canvasRenderer.SetMesh(s_Mesh);
|
||||
canvasRenderer.SetMesh(s_Mesh);
|
||||
}
|
||||
else if (i - 1 < subMeshes.Count)
|
||||
{
|
||||
@@ -252,29 +275,20 @@ namespace Coffee.UIEffects
|
||||
modifier.ModifyMesh(s_VertexHelper);
|
||||
}
|
||||
|
||||
var subMeshUI = GetSubMeshUI(subMeshes, meshInfo.material, i - 1);
|
||||
if (!subMeshUI) break;
|
||||
var subMeshUI = GetSubMeshUI(subMeshes, meshInfo.material, meshInfo.mesh, i - 1);
|
||||
if (subMeshUI == null) break;
|
||||
|
||||
var replica = subMeshUI.GetOrAddComponent<UIEffectReplica>();
|
||||
if (effect is UIEffect pEffect && pEffect.isActiveAndEnabled)
|
||||
// fix: TMP Text sprite submesh lost when changing fontMaterial (#368)
|
||||
if (!subMeshUI.TryGetComponent<UIEffectReplica>(out var replica))
|
||||
{
|
||||
replica.target = pEffect;
|
||||
replica.useTargetTransform = true;
|
||||
replica.customRoot = null;
|
||||
}
|
||||
else if (effect is UIEffectReplica pReplica && pReplica.isActiveAndEnabled)
|
||||
{
|
||||
replica.target = pReplica.target;
|
||||
replica.preset = pReplica.preset;
|
||||
replica.useTargetTransform = pReplica.useTargetTransform;
|
||||
replica.customRoot = pReplica.customRoot;
|
||||
}
|
||||
else
|
||||
{
|
||||
replica.target = null;
|
||||
replica.customRoot = null;
|
||||
replica = subMeshUI.gameObject.AddComponent<UIEffectReplica>();
|
||||
textMeshProUGUI.RegisterDirtyMaterialCallback(() =>
|
||||
{
|
||||
if (subMeshUI != null) subMeshUI.SetMaterialDirty();
|
||||
});
|
||||
}
|
||||
|
||||
replica.SetTarget(effect);
|
||||
subMeshUI.GetComponents(subModifiers);
|
||||
foreach (var modifier in subModifiers)
|
||||
{
|
||||
@@ -282,7 +296,10 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
|
||||
s_VertexHelper.FillMesh(s_Mesh);
|
||||
subMeshUI.canvasRenderer.SetMesh(s_Mesh);
|
||||
if (subMeshUI.canvasRenderer != null)
|
||||
{
|
||||
subMeshUI.canvasRenderer.SetMesh(s_Mesh);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -297,12 +314,24 @@ namespace Coffee.UIEffects
|
||||
Misc.QueuePlayerLoopUpdate();
|
||||
}
|
||||
|
||||
private static TMP_SubMeshUI GetSubMeshUI(List<TMP_SubMeshUI> subMeshes, Material material, int start)
|
||||
private static TMP_SubMeshUI GetSubMeshUI(List<TMP_SubMeshUI> subMeshes, Material material, Mesh mesh,
|
||||
int start)
|
||||
{
|
||||
var count = subMeshes.Count;
|
||||
if (mesh != null)
|
||||
{
|
||||
for (var j = 0; j < count; j++)
|
||||
{
|
||||
var s = subMeshes[(j + start + count) % count];
|
||||
if (s == null) continue;
|
||||
if (s.mesh == mesh) return s;
|
||||
}
|
||||
}
|
||||
|
||||
for (var j = 0; j < count; j++)
|
||||
{
|
||||
var s = subMeshes[(j + start + count) % count];
|
||||
if (s == null) continue;
|
||||
if (s.sharedMaterial == material) return s;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user