Compare commits

...

83 Commits

Author SHA1 Message Date
semantic-release-bot 3ff52e4735 chore(release): 5.8.4 [skip ci]
## [5.8.4](https://github.com/mob-sakai/UIEffect/compare/5.8.3...5.8.4) (2025-04-30)

### Bug Fixes

* NRE while canvas is disabled ([a3773e3](https://github.com/mob-sakai/UIEffect/commit/a3773e33028c60517fb4e6c534f6280194df8e64)), closes [#342](https://github.com/mob-sakai/UIEffect/issues/342)
2025-04-30 22:53:37 +00:00
mob-sakai a3773e3302 fix: NRE while canvas is disabled
close #342
2025-05-01 07:53:04 +09:00
semantic-release-bot 5a9f335bf8 chore(release): 5.8.3 [skip ci]
## [5.8.3](https://github.com/mob-sakai/UIEffect/compare/5.8.2...5.8.3) (2025-04-30)

### Bug Fixes

* the alpha of the gradation color and gradient was being ignored ([3807e4c](https://github.com/mob-sakai/UIEffect/commit/3807e4c69aefaef04b2245522e7c5085ccc65a36)), closes [#341](https://github.com/mob-sakai/UIEffect/issues/341)
2025-04-30 09:49:34 +00:00
mob-sakai 3807e4c69a fix: the alpha of the gradation color and gradient was being ignored
close #341
2025-04-30 18:48:27 +09:00
semantic-release-bot 184967c120 chore(release): 5.8.2 [skip ci]
## [5.8.2](https://github.com/mob-sakai/UIEffect/compare/5.8.1...5.8.2) (2025-04-23)

### Bug Fixes

* `Flip` is ignored when loading a preset ([e1f3abf](https://github.com/mob-sakai/UIEffect/commit/e1f3abf7a65b62718b28e33ac2f7d700c3ae3f5a))
* fix detail color ([90ab16c](https://github.com/mob-sakai/UIEffect/commit/90ab16c3fd46435ebf7c8e47ffb4ec521d2f61c9))
* indicate in the inspector using tooltips and asterisks that `Rotation` and `Keep Aspect Ratio` are shared properties ([2cca822](https://github.com/mob-sakai/UIEffect/commit/2cca822413aa7580e1eb777c3295d1de928cd65f))
2025-04-23 23:24:29 +00:00
mob-sakai 2cca822413 fix: indicate in the inspector using tooltips and asterisks that Rotation and Keep Aspect Ratio are shared properties 2025-04-19 10:22:34 +09:00
mob-sakai 90ab16c3fd fix: fix detail color 2025-04-19 10:22:34 +09:00
mob-sakai e1f3abf7a6 fix: Flip is ignored when loading a preset 2025-04-19 10:21:16 +09:00
mob-sakai 770e61bb12 chore: refactor 2025-04-18 17:32:30 +09:00
mob-sakai a0820bf847 chore: update coffee.internal 2025-04-18 17:14:44 +09:00
semantic-release-bot 1a21464c0e chore(release): 5.8.1 [skip ci]
## [5.8.1](https://github.com/mob-sakai/UIEffect/compare/5.8.0...5.8.1) (2025-04-17)

### Bug Fixes

* built-in presets cannot be used with `UIEffectReplica` ([1106f4b](https://github.com/mob-sakai/UIEffect/commit/1106f4bf4632e1372d44ced9a38e98209a6b55e8))
* New presets ignore `DetailColor` property ([1143fbb](https://github.com/mob-sakai/UIEffect/commit/1143fbb84a1e08817de93f1349ee5cdad0972db5)), closes [#336](https://github.com/mob-sakai/UIEffect/issues/336)
* prevent built-in preset assets from being editable ([0898d73](https://github.com/mob-sakai/UIEffect/commit/0898d730add42970fb74bf2ad8aca9809bf6dd39))
2025-04-17 11:20:54 +00:00
mob-sakai 1143fbb84a fix: New presets ignore DetailColor property
close #336
2025-04-17 20:20:14 +09:00
mob-sakai eff923493a update demo 2025-04-17 18:56:24 +09:00
mob-sakai 0898d730ad fix: prevent built-in preset assets from being editable 2025-04-17 17:48:12 +09:00
mob-sakai 1106f4bf46 fix: built-in presets cannot be used with UIEffectReplica 2025-04-17 17:38:03 +09:00
semantic-release-bot 2861b1ce61 chore(release): 5.8.0 [skip ci]
# [5.8.0](https://github.com/mob-sakai/UIEffect/compare/5.7.0...5.8.0) (2025-04-17)

### Bug Fixes

* `ShadowMode.Mirror` does not flip the effect ([37daad0](https://github.com/mob-sakai/UIEffect/commit/37daad01c4f3f4c259650b1493aeae204e0bd247))
* fix alpha clipping for ShaderGraph ([ae177a8](https://github.com/mob-sakai/UIEffect/commit/ae177a800cba1561b523292279d7986d4eff9f9c))
* unable to add editor presets as runtime presets to project settings ([726bb10](https://github.com/mob-sakai/UIEffect/commit/726bb100a0ad327619634ea73ccdccc36276d0d0)), closes [#330](https://github.com/mob-sakai/UIEffect/issues/330)

### Features

* add `DetailColor` property ([30bf783](https://github.com/mob-sakai/UIEffect/commit/30bf783320398d68b90b09b0dcf93738b4683e00)), closes [#332](https://github.com/mob-sakai/UIEffect/issues/332)
* ScriptableObject based preset system ([f8682f3](https://github.com/mob-sakai/UIEffect/commit/f8682f3c9889fb56ff3cd9010934f998e121553a)), closes [#333](https://github.com/mob-sakai/UIEffect/issues/333)
2025-04-17 05:07:03 +00:00
mob-sakai 6eabdc694e docs: update readme 2025-04-17 14:06:24 +09:00
mob-sakai ae177a800c fix: fix alpha clipping for ShaderGraph 2025-04-17 02:57:46 +09:00
mob-sakai 88bb76d735 update demo 2025-04-17 02:57:46 +09:00
mob-sakai 37daad01c4 fix: ShadowMode.Mirror does not flip the effect 2025-04-17 02:57:46 +09:00
mob-sakai 1ce32f7829 refactor: refactor code 2025-04-17 02:23:09 +09:00
mob-sakai 726bb100a0 fix: unable to add editor presets as runtime presets to project settings
close #330
2025-04-17 02:23:09 +09:00
mob-sakai f8682f3c98 feat: ScriptableObject based preset system
NOTE: This change will rename the built-in runtime preset.
For example, change the name `001 - Tone - Glayscale` to `Tone-Glayscale`.
close #333
2025-04-17 02:23:09 +09:00
mob-sakai 99669728cc refactor: refactor code 2025-04-17 02:23:09 +09:00
mob-sakai 30bf783320 feat: add DetailColor property
close #332
2025-04-17 02:23:09 +09:00
semantic-release-bot d6ee505e7c chore(release): 5.7.0 [skip ci]
# [5.7.0](https://github.com/mob-sakai/UIEffect/compare/5.6.4...5.7.0) (2025-04-11)

### Bug Fixes

* colors appeared darker when alpha was low ([21172f3](https://github.com/mob-sakai/UIEffect/commit/21172f37c21792906ac9e33827c771d388397653))
* shrink shader variants for color filters ([7f60a56](https://github.com/mob-sakai/UIEffect/commit/7f60a56a9af6b4ecee223b466f1b2499af0194f4))

### Features

* `UIEffectReplica.flip` has been deprecated ([6af34e2](https://github.com/mob-sakai/UIEffect/commit/6af34e2994378fd33025b41fe08898b552aa08ab))
* add `GradationIntensity` and `GradationColorFilter` properties ([a6781b9](https://github.com/mob-sakai/UIEffect/commit/a6781b92899c38f49eccfebf4173028955a5aced))
* calculate the normalized position on the shader side ([01bbeed](https://github.com/mob-sakai/UIEffect/commit/01bbeedde7cf2d757d6d295475f0ad9acd24dce3)), closes [#323](https://github.com/mob-sakai/UIEffect/issues/323) [#324](https://github.com/mob-sakai/UIEffect/issues/324)
* ShaderGraph support ([2dd2e26](https://github.com/mob-sakai/UIEffect/commit/2dd2e261666b611be3a1fd5ac112db34fd99038e)), closes [#326](https://github.com/mob-sakai/UIEffect/issues/326)
2025-04-11 07:35:55 +00:00
mob-sakai 3917df60af docs: update readme 2025-04-11 09:52:49 +09:00
mob-sakai 6845678f8f chore: update test workflows 2025-04-11 09:50:48 +09:00
mob-sakai 9fbaae7d07 demo: add urp project 2025-04-11 09:50:48 +09:00
mob-sakai 3d1abb979a chore: update demos 2025-04-11 09:50:48 +09:00
mob-sakai 6af34e2994 feat: UIEffectReplica.flip has been deprecated 2025-04-11 09:50:48 +09:00
mob-sakai a6781b9289 feat: add GradationIntensity and GradationColorFilter properties 2025-04-11 09:50:48 +09:00
mob-sakai 7f60a56a9a fix: shrink shader variants for color filters
This avoids the local shader variant limit (=60).
Since it uses a uniform branch, there is no impact on rendering performance.
2025-04-11 03:17:40 +09:00
mob-sakai 2dd2e26166 feat: ShaderGraph support
close #326
2025-04-11 03:17:40 +09:00
mob-sakai 21172f37c2 fix: colors appeared darker when alpha was low 2025-04-10 18:07:46 +09:00
mob-sakai 01bbeedde7 feat: calculate the normalized position on the shader side
With this change, UIEffect becomes up to 50% faster.
Additionally, gradients are rendered more beautifully.
close #323, close #324
2025-04-10 18:07:46 +09:00
semantic-release-bot c6fa44a0b6 chore(release): 5.6.4 [skip ci]
## [5.6.4](https://github.com/mob-sakai/UIEffect/compare/5.6.3...5.6.4) (2025-04-10)

### Bug Fixes

* avoid potential allocations ([26da24d](https://github.com/mob-sakai/UIEffect/commit/26da24dbc4022dcd71e7a58e5f02a6922ba2ddff))
* optional shaders do not support all shader combinations ([6014ab5](https://github.com/mob-sakai/UIEffect/commit/6014ab54d010872f8fee63fc961ac5ab2edd08e1))
2025-04-10 09:07:31 +00:00
mob-sakai 26da24dbc4 fix: avoid potential allocations 2025-04-10 09:26:09 +09:00
mob-sakai 6014ab54d0 fix: optional shaders do not support all shader combinations 2025-04-08 23:40:58 +09:00
semantic-release-bot dbdb99b52a chore(release): 5.6.3 [skip ci]
## [5.6.3](https://github.com/mob-sakai/UIEffect/compare/5.6.2...5.6.3) (2025-04-06)

### Bug Fixes

* fix a potential `ArgumentOutOfRangeException` that could occur when changing the FontAsset in TextMeshPro ([3b095bc](https://github.com/mob-sakai/UIEffect/commit/3b095bcebd8b1264c373b8b71c27d3c35f673f3b)), closes [#327](https://github.com/mob-sakai/UIEffect/issues/327)
2025-04-06 22:39:51 +00:00
mob-sakai 3b095bcebd fix: fix a potential ArgumentOutOfRangeException that could occur when changing the FontAsset in TextMeshPro
close #327
2025-04-07 07:39:18 +09:00
semantic-release-bot 2a900987f5 chore(release): 5.6.2 [skip ci]
## [5.6.2](https://github.com/mob-sakai/UIEffect/compare/5.6.1...5.6.2) (2025-04-04)

### Bug Fixes

* fix a potential `ArgumentOutOfRangeException` that could occur when changing the FontAsset in TextMeshPro ([909281c](https://github.com/mob-sakai/UIEffect/commit/909281c66b702d8497e9f847c91b688716b9c6a7)), closes [#327](https://github.com/mob-sakai/UIEffect/issues/327)
* Remove unnecessary vertex expansion ([974e3e8](https://github.com/mob-sakai/UIEffect/commit/974e3e8769d456c5cdd8eb1767a7cf57ab4d52fc))
* undo now works correctly after clicking the 'Clear' button in the inspector ([75ed355](https://github.com/mob-sakai/UIEffect/commit/75ed355e27faf8962390eb6788e1887ffd1b5f89))
2025-04-04 11:20:33 +00:00
mob-sakai 974e3e8769 fix: Remove unnecessary vertex expansion 2025-04-04 14:29:39 +09:00
mob-sakai 909281c66b fix: fix a potential ArgumentOutOfRangeException that could occur when changing the FontAsset in TextMeshPro
close #327
2025-04-04 13:56:00 +09:00
mob-sakai 75ed355e27 fix: undo now works correctly after clicking the 'Clear' button in the inspector 2025-04-04 13:55:51 +09:00
mob-sakai a0dd316df6 docs: update readme 2025-03-29 01:37:36 +09:00
semantic-release-bot 4f66bbfb4d chore(release): 5.6.1 [skip ci]
## [5.6.1](https://github.com/mob-sakai/UIEffect/compare/5.6.0...5.6.1) (2025-03-28)

### Bug Fixes

* changes were not correctly marked as dirty when loading presets ([76be0fc](https://github.com/mob-sakai/UIEffect/commit/76be0fc860c27b89235b7fb9a766dcc38b3d9924))
2025-03-28 11:18:28 +00:00
mob-sakai 91d5519356 docs: update docs 2025-03-28 20:17:37 +09:00
mob-sakai 76be0fc860 fix: changes were not correctly marked as dirty when loading presets 2025-03-28 20:17:36 +09:00
semantic-release-bot a7e826c4f9 chore(release): 5.6.0 [skip ci]
# [5.6.0](https://github.com/mob-sakai/UIEffect/compare/5.5.3...5.6.0) (2025-03-28)

### Bug Fixes

* fix edge detection ([9462170](https://github.com/mob-sakai/UIEffect/commit/946217069f10714798070481d8576f5470e243db))
* fix project settings icon ([202601c](https://github.com/mob-sakai/UIEffect/commit/202601c96d6fb564ee5d6b8868b0ff0a8dba0ba1))
* the strength of ColorGlow, TransitionColorGlow, and ShadowColorGlow now changes according to intensity ([aa4ec8d](https://github.com/mob-sakai/UIEffect/commit/aa4ec8d9c449bfe361aa277e25cbb389e0daa983)), closes [#316](https://github.com/mob-sakai/UIEffect/issues/316)
* UIEffect with TextMeshPro SubMeshUI appears black in the editor when saving assets ([de91871](https://github.com/mob-sakai/UIEffect/commit/de918718d062979c8e9b4202b6b2ae389ae10bab))

### Features

* `TransitionAutoPlaySpeed`, `TransitionTexSpeed`, and `EdgeShinyAutoPlaySpeed` are previewed only when the object is selected in edit mode ([952a94f](https://github.com/mob-sakai/UIEffect/commit/952a94f50b3ae4279a48b03d019f341e46b2f5b7)), closes [#319](https://github.com/mob-sakai/UIEffect/issues/319)
* add 'Flip' feature ([def49c3](https://github.com/mob-sakai/UIEffect/commit/def49c34f5b963c8b0cce6fb8cace3f7d93b5a1e))
* add `Detail Filter` feature ([3e2c5c1](https://github.com/mob-sakai/UIEffect/commit/3e2c5c1613d9a2c08487d94c4eef28f066f2eb7b))
* add `EdgeColorGlow` option ([53db1e6](https://github.com/mob-sakai/UIEffect/commit/53db1e62546384f04b9c526df2623c4598dd34bf))
* add `onChangeRate` event for UIEffectTweener ([8ad57c8](https://github.com/mob-sakai/UIEffect/commit/8ad57c828ef4f1d7df6dd22c1edb7af3efa04d75)), closes [#321](https://github.com/mob-sakai/UIEffect/issues/321)
* add `TransitionTexSpeed` option ([6b8dc5e](https://github.com/mob-sakai/UIEffect/commit/6b8dc5ec338590d909511eba3bb1b2e0ec6627f3))
* add a tool that automatically fixes shaders when 'TextMeshPro Essential Resources' are located in a non-default path ([8388d59](https://github.com/mob-sakai/UIEffect/commit/8388d590457755cda0699835b37b5bf0673c4386))
* add built-in presets ([3db94e0](https://github.com/mob-sakai/UIEffect/commit/3db94e00f83195ff90d26ee270c7984825fa22b7))
* add shaders for TextMeshPro Overlay/SSD ([51cd6d8](https://github.com/mob-sakai/UIEffect/commit/51cd6d8525a12581c8afd4ab5d16e5968e15c8fe))
* Allow specifying a preset as the target for `UIEffectReplica` ([cb0e8d2](https://github.com/mob-sakai/UIEffect/commit/cb0e8d283bb8f9085d4910051b5ae0b77368db76))
* custom transform for transition and gradation ([045db9c](https://github.com/mob-sakai/UIEffect/commit/045db9c3b79234cd12bdfb4ea52898b7d86240af))
* expose color subfields as float-type public properties ([396d06f](https://github.com/mob-sakai/UIEffect/commit/396d06f774e10adee84d06156a7fc8723d986bbd)), closes [#321](https://github.com/mob-sakai/UIEffect/issues/321)
* load presets partially and append to existing instance ([6542543](https://github.com/mob-sakai/UIEffect/commit/654254342265fc239804e60a64d01b80076e5e8e))
* separate reverse curve for UIEffectTweener ([2540b75](https://github.com/mob-sakai/UIEffect/commit/2540b75349af92f1359433e73ffa3b5400479b02)), closes [#312](https://github.com/mob-sakai/UIEffect/issues/312)
* support `SoftMaskForUGUI ` package with `UIEffect` ([65457e2](https://github.com/mob-sakai/UIEffect/commit/65457e263644c36cd772ad1f42fb9fb3f84ab753)), closes [#270](https://github.com/mob-sakai/UIEffect/issues/270)
* support UIFlip as v4 compatible component ([e965b9e](https://github.com/mob-sakai/UIEffect/commit/e965b9e9ab33dcfab067542abf2f19bc1d5243fc)), closes [#322](https://github.com/mob-sakai/UIEffect/issues/322)
* update demo sample ([abc9a41](https://github.com/mob-sakai/UIEffect/commit/abc9a4184c4aeac85287a882d174f9cdc2c28c04)), closes [#318](https://github.com/mob-sakai/UIEffect/issues/318) [#320](https://github.com/mob-sakai/UIEffect/issues/320)
2025-03-28 09:16:55 +00:00
mob-sakai 78fbc9a330 docs: update readme
close #317
2025-03-19 09:24:06 +09:00
mob-sakai abc9a4184c feat: update demo sample
close #318, close #320
2025-03-19 09:24:05 +09:00
mob-sakai 3e2c5c1613 feat: add Detail Filter feature 2025-03-19 09:24:05 +09:00
mob-sakai cb0e8d283b feat: Allow specifying a preset as the target for UIEffectReplica 2025-03-19 09:24:05 +09:00
mob-sakai def49c34f5 feat: add 'Flip' feature 2025-03-19 09:24:05 +09:00
mob-sakai a0ac27291b chore: add symbolic linker for development 2025-03-19 09:24:05 +09:00
mob-sakai 8388d59045 feat: add a tool that automatically fixes shaders when 'TextMeshPro Essential Resources' are located in a non-default path 2025-03-19 09:24:05 +09:00
mob-sakai 53db1e6254 feat: add EdgeColorGlow option 2025-03-19 09:24:05 +09:00
mob-sakai aa4ec8d9c4 fix: the strength of ColorGlow, TransitionColorGlow, and ShadowColorGlow now changes according to intensity
close #316
2025-03-19 09:24:05 +09:00
mob-sakai e965b9e9ab feat: support UIFlip as v4 compatible component
close #322
2025-03-19 09:24:05 +09:00
mob-sakai 202601c96d fix: fix project settings icon 2025-03-19 09:24:05 +09:00
mob-sakai 396d06f774 feat: expose color subfields as float-type public properties
close #321
2025-03-19 09:24:05 +09:00
mob-sakai 8ad57c828e feat: add onChangeRate event for UIEffectTweener
close #321
2025-03-19 09:24:05 +09:00
mob-sakai 952a94f50b feat: TransitionAutoPlaySpeed, TransitionTexSpeed, and EdgeShinyAutoPlaySpeed are previewed only when the object is selected in edit mode
close #319
2025-03-19 09:24:05 +09:00
mob-sakai 2540b75349 feat: separate reverse curve for UIEffectTweener
close #312
2025-03-19 09:24:05 +09:00
mob-sakai 6b8dc5ec33 feat: add TransitionTexSpeed option 2025-03-19 09:24:05 +09:00
mob-sakai de918718d0 fix: UIEffect with TextMeshPro SubMeshUI appears black in the editor when saving assets 2025-03-19 09:24:05 +09:00
mob-sakai 045db9c3b7 feat: custom transform for transition and gradation 2025-03-19 09:24:05 +09:00
mob-sakai 6542543422 feat: load presets partially and append to existing instance 2025-03-19 09:24:05 +09:00
mob-sakai 3db94e00f8 feat: add built-in presets 2025-03-18 19:43:11 +09:00
mob-sakai 946217069f fix: fix edge detection 2025-03-18 19:43:11 +09:00
mob-sakai 51cd6d8525 feat: add shaders for TextMeshPro Overlay/SSD 2025-03-14 18:05:27 +09:00
mob-sakai 65457e2636 feat: support SoftMaskForUGUI package with UIEffect
This feature allow `UIEffect` component to automatically select shaders like 'UIEffect-SoftMaskable' without any manual configuration.
close #270
2025-03-06 17:50:56 +09:00
semantic-release-bot 3eb775dcf5 chore(release): 5.5.3 [skip ci]
## [5.5.3](https://github.com/mob-sakai/UIEffect/compare/5.5.2...5.5.3) (2025-03-06)

### Bug Fixes

* blur with 'Filled' Image type may cause error ([f0a7642](https://github.com/mob-sakai/UIEffect/commit/f0a76424e690355c101cc2e12183d1a7e77b16c3)), closes [#313](https://github.com/mob-sakai/UIEffect/issues/313)
* IL2CPP build fails on older versions of Unity ([1af89af](https://github.com/mob-sakai/UIEffect/commit/1af89af2c58320f67b8d753767b3b4cf905f844d)), closes [#315](https://github.com/mob-sakai/UIEffect/issues/315)
2025-03-06 08:50:27 +00:00
mob-sakai 1af89af2c5 fix: IL2CPP build fails on older versions of Unity
close #315
2025-03-06 16:59:35 +09:00
mob-sakai f0a76424e6 fix: blur with 'Filled' Image type may cause error
close #313
2025-03-06 16:59:35 +09:00
mob-sakai f2753e9a3d chore: update devtool for windows 2025-03-06 16:59:35 +09:00
semantic-release-bot 91e5be706d chore(release): 5.5.2 [skip ci]
## [5.5.2](https://github.com/mob-sakai/UIEffect/compare/5.5.1...5.5.2) (2025-02-28)

### Bug Fixes

* `PlayOnEnable.Reverse` in UIEffectTweener does not work ([3f5a7dc](https://github.com/mob-sakai/UIEffect/commit/3f5a7dcd2d8248b9e47fb9d38c083f26b798e063)), closes [#310](https://github.com/mob-sakai/UIEffect/issues/310)
* `TransitionFilter` and `GradationMode` do not work correctly when the initial scale is 0 ([bdbf293](https://github.com/mob-sakai/UIEffect/commit/bdbf293c1489c0b248078969b37ec66890620d44)), closes [#311](https://github.com/mob-sakai/UIEffect/issues/311)
* component icons will no longer be displayed in the scene view (Unity 2021.2 or later) ([40ff828](https://github.com/mob-sakai/UIEffect/commit/40ff828ff0697dc8f6597cfcf094cc63532a19dd))
* fix potential issues ([a748adf](https://github.com/mob-sakai/UIEffect/commit/a748adf1bde5e400fcc84ec902a1438867105f75))
* reset time button does not work correctly in the inspector when `UIEffectTweener.direction=Reverse` in the editor ([8513970](https://github.com/mob-sakai/UIEffect/commit/8513970e6f71d393430a573bfb0207428998bee1)), closes [#310](https://github.com/mob-sakai/UIEffect/issues/310)
2025-02-28 09:04:55 +00:00
mob-sakai 8513970e6f fix: reset time button does not work correctly in the inspector when UIEffectTweener.direction=Reverse in the editor
close #310
2025-02-28 17:37:37 +09:00
mob-sakai 3f5a7dcd2d fix: PlayOnEnable.Reverse in UIEffectTweener does not work
close #310
2025-02-27 18:41:37 +09:00
mob-sakai a748adf1bd fix: fix potential issues 2025-02-27 17:43:54 +09:00
mob-sakai 40ff828ff0 fix: component icons will no longer be displayed in the scene view (Unity 2021.2 or later) 2025-02-27 17:43:54 +09:00
mob-sakai bdbf293c14 fix: TransitionFilter and GradationMode do not work correctly when the initial scale is 0
close #311
2025-02-27 09:29:51 +09:00
490 changed files with 189379 additions and 13943 deletions
+126
View File
@@ -0,0 +1,126 @@
# Required secrets
# UNITY_LICENSE: The contents of Unity license file
# UNITY_EMAIL: Unity user email to login
# UNITY_PASSWORD: Unity user password to login
name: 🧪 Test URP
run-name: 🧪 Test URP (${{ github.event.pull_request.title || github.ref_name }})
env:
# MINIMUM_VERSION: The minimum version of Unity.
MINIMUM_VERSION: 6000.0
# EXCLUDE_FILTER: The excluded versions of Unity.
EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.2|2023.3)"
PROJECT_PATH: UIEffectURP
on:
workflow_dispatch:
inputs:
usePeriodVersions:
description: "Use the period versions (.0f1, .10f1, 20f1, ...)."
required: false
default: "true"
push:
branches:
- develop
- "develop-*"
tags:
- "!*"
paths-ignore:
- "**.md"
pull_request_target:
types:
- opened
- reopened
- synchronize
paths-ignore:
- "**.md"
jobs:
setup:
name: ⚙️ Setup
runs-on: ubuntu-latest
outputs:
unityVersions: ${{ steps.setup.outputs.unityVersions }}
steps:
- 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`
if [ "${{ inputs.usePeriodVersions }}" = "true" ]; then
ADDITIONAL_VERSIONS=`npx unity-changeset list --versions --grep '0f' --min ${MINIMUM_VERSION} --json`
else
ADDITIONAL_VERSIONS=[]
fi
VERSIONS=`echo "[${LATEST_VERSIONS}, ${ADDITIONAL_VERSIONS}]" \
| jq -c '[ flatten | sort | unique | .[] | select( test("${{ env.EXCLUDE_FILTER }}") | not ) ]'`
echo "unityVersions=${VERSIONS}" | tee $GITHUB_OUTPUT
test:
name: 🧪 Run tests
runs-on: ubuntu-latest
permissions:
checks: write
contents: read
needs: setup
strategy:
fail-fast: false
max-parallel: 6
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
- name: 📥 Cache library
uses: actions/cache@v4
with:
path: Library
key: Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
restore-keys: |
Library-${{ matrix.unityVersion }}-
Library-
- name: 🛠️ Build Unity Project (Test)
uses: game-ci/unity-builder@v4
timeout-minutes: 45
with:
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
targetPlatform: StandaloneLinux64
allowDirtyBuild: true
customParameters: -nographics
projectPath: ${{ env.PROJECT_PATH }}
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
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 }}
+3
View File
@@ -10,6 +10,7 @@ env:
MINIMUM_VERSION: 2020.3
# EXCLUDE_FILTER: The excluded versions of Unity.
EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.2|2023.3)"
PROJECT_PATH: .
on:
workflow_dispatch:
@@ -104,6 +105,7 @@ jobs:
targetPlatform: StandaloneLinux64
allowDirtyBuild: true
customParameters: -nographics
projectPath: ${{ env.PROJECT_PATH }}
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
@@ -118,6 +120,7 @@ jobs:
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 }}
@@ -1,74 +0,0 @@
using System;
using System.Linq;
using UnityEngine;
using Coffee.UIEffects;
using UnityEngine.Events;
using UnityEngine.UI;
public class ControlByScript : MonoBehaviour
{
[SerializeField]
private UIEffect m_Effect;
[SerializeField]
private ControlTemplate m_ControlTemplate;
private void Start()
{
m_ControlTemplate.Instantiate()
.InitAsDropDown(nameof(m_Effect.toneFilter), typeof(ToneFilter),
(int)m_Effect.toneFilter, x => m_Effect.toneFilter = (ToneFilter)x);
m_ControlTemplate.Instantiate()
.InitAsSlider(nameof(m_Effect.toneIntensity), m_Effect.toneIntensity, x => m_Effect.toneIntensity = x);
m_ControlTemplate.Instantiate()
.InitAsDropDown(nameof(m_Effect.colorFilter), typeof(ColorFilter),
(int)m_Effect.colorFilter, x => m_Effect.colorFilter = (ColorFilter)x);
m_ControlTemplate.Instantiate()
.InitAsSlider(nameof(m_Effect.colorIntensity), m_Effect.colorIntensity, x => m_Effect.colorIntensity = x);
m_ControlTemplate.Instantiate()
.InitAsColorDropDown(nameof(m_Effect.color), m_Effect.color, x => m_Effect.color = x);
m_ControlTemplate.Instantiate()
.InitAsSlider("Hue", m_Effect.color.r, x =>
{
var color = m_Effect.color;
color.r = x;
m_Effect.color = color;
});
m_ControlTemplate.Instantiate()
.InitAsToggle(nameof(m_Effect.colorGlow), m_Effect.colorGlow, x => m_Effect.colorGlow = x);
}
private void AddColor(ColorFilter filter, Action<ColorFilter> filterSetter,
float intensity, Action<float> intensitySetter,
Color color, Action<Color> colorSetter,
bool glow, Action<bool> glowSetter)
{
m_ControlTemplate.Instantiate()
.InitAsDropDown(nameof(m_Effect.colorFilter), typeof(ColorFilter),
(int)m_Effect.colorFilter, x => m_Effect.colorFilter = (ColorFilter)x);
m_ControlTemplate.Instantiate()
.InitAsSlider(nameof(m_Effect.colorIntensity), m_Effect.colorIntensity, x => m_Effect.colorIntensity = x);
m_ControlTemplate.Instantiate()
.InitAsColorDropDown(nameof(m_Effect.color), m_Effect.color, x => m_Effect.color = x);
m_ControlTemplate.Instantiate()
.InitAsSlider("Hue", m_Effect.color.r, x =>
{
var color = m_Effect.color;
color.r = x;
m_Effect.color = color;
});
m_ControlTemplate.Instantiate()
.InitAsToggle(nameof(m_Effect.colorGlow), m_Effect.colorGlow, x => m_Effect.colorGlow = x);
}
}
File diff suppressed because it is too large Load Diff
@@ -1,110 +0,0 @@
using System;
using System.Linq;
using UnityEngine;
using Coffee.UIEffects;
using UnityEngine.Events;
using UnityEngine.Serialization;
using UnityEngine.UI;
public class ControlTemplate : MonoBehaviour
{
[SerializeField]
private Text m_Label;
[SerializeField]
private Dropdown m_Dropdown;
[SerializeField]
private Slider m_Slider;
[SerializeField]
private Toggle m_Toggle;
[SerializeField]
private RawImage m_RawImage;
public ControlTemplate Instantiate()
{
var go = Instantiate(gameObject, transform.parent, false);
return go.GetComponent<ControlTemplate>();
}
public void InitAsDropDown(string label, Type enumType, int value, UnityAction<int> onValueChanged)
{
m_Label.text = label;
m_Dropdown.ClearOptions();
m_Dropdown.AddOptions(Enum.GetNames(enumType).ToList());
m_Dropdown.onValueChanged.RemoveAllListeners();
m_Dropdown.onValueChanged.AddListener(onValueChanged);
m_Dropdown.SetValueWithoutNotify(value);
// m_Dropdown.gameObject.SetActive(false);
m_Slider.gameObject.SetActive(false);
m_Toggle.gameObject.SetActive(false);
m_RawImage.gameObject.SetActive(false);
}
private static readonly (string name, Color color)[] s_Colors = new (string, Color)[]
{
("-", Color.clear),
("White", Color.white),
("Red", Color.red),
("Green", Color.green),
("Blue", Color.blue),
("Yellow", Color.yellow),
("Cyan", Color.cyan),
("Magenta", Color.magenta),
("Black", Color.black)
};
public void InitAsColorDropDown(string label, Color value, UnityAction<Color> onValueChanged)
{
m_Label.text = label;
m_Dropdown.ClearOptions();
m_Dropdown.AddOptions(s_Colors.Select(x => x.name).ToList());
m_Dropdown.onValueChanged.RemoveAllListeners();
m_Dropdown.onValueChanged.AddListener(x =>
{
m_RawImage.color = s_Colors[x].color;
onValueChanged(s_Colors[x].color);
});
m_RawImage.color = value;
m_Dropdown.SetValueWithoutNotify(0);
// m_Dropdown.gameObject.SetActive(false);
m_Slider.gameObject.SetActive(false);
m_Toggle.gameObject.SetActive(false);
m_RawImage.gameObject.SetActive(true);
}
public void InitAsSlider(string label, float value, UnityAction<float> onValueChanged)
{
m_Label.text = label;
m_Slider.onValueChanged.RemoveAllListeners();
m_Slider.onValueChanged.AddListener(onValueChanged);
m_Slider.SetValueWithoutNotify(value);
m_Dropdown.gameObject.SetActive(false);
// m_Slider.gameObject.SetActive(false);
m_Toggle.gameObject.SetActive(false);
m_RawImage.gameObject.SetActive(false);
}
public void InitAsToggle(string label, bool value, UnityAction<bool> onValueChanged)
{
m_Label.text = label;
m_Toggle.onValueChanged.RemoveAllListeners();
m_Toggle.onValueChanged.AddListener(onValueChanged);
m_Toggle.SetIsOnWithoutNotify(value);
m_Dropdown.gameObject.SetActive(false);
m_Slider.gameObject.SetActive(false);
// m_Toggle.gameObject.SetActive(false);
m_RawImage.gameObject.SetActive(false);
}
}
+25 -4
View File
@@ -1,14 +1,35 @@
using Coffee.UIEffects;
using UnityEngine;
[ExecuteAlways]
public class GradationTest : MonoBehaviour
{
[SerializeField] private UIEffect m_Target;
[Range(-1, 1)]
[SerializeField]
protected float m_GradationOffset = 0;
[SerializeField] private Gradient m_Gradient;
[Range(0.01f, 10)]
[SerializeField]
protected float m_GradationScale = 1;
public void SetGradation()
[SerializeField]
[Range(0, 360)]
private float m_GradationRotation = 0;
private UIEffect[] _uiEffects;
private void Awake()
{
m_Target.SetGradientKeys(m_Gradient.colorKeys, m_Gradient.alphaKeys, m_Gradient.mode);
_uiEffects = GetComponentsInChildren<UIEffect>(true);
}
private void OnValidate()
{
foreach (var uiEffect in _uiEffects)
{
uiEffect.gradationOffset = m_GradationOffset;
uiEffect.gradationScale = m_GradationScale;
uiEffect.gradationRotation = m_GradationRotation;
}
}
}
File diff suppressed because it is too large Load Diff
+932
View File
@@ -0,0 +1,932 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &1256184
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1256185}
m_Layer: 5
m_Name: Root
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1256185
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1256184}
m_LocalRotation: {x: 0.1981076, y: 0.13871644, z: 0.13871644, w: 0.9603483}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1022391538}
m_Father: {fileID: 320007022}
m_LocalEulerAnglesHint: {x: 20, y: 20, z: 20}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 200}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &320007018
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 320007022}
- component: {fileID: 320007021}
- component: {fileID: 320007020}
- component: {fileID: 320007019}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &320007019
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320007018}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &320007020
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320007018}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &320007021
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320007018}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 1076137588}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 1
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &320007022
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320007018}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1256185}
- {fileID: 2068343013}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &1022391537
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1022391538}
- component: {fileID: 1022391541}
- component: {fileID: 1022391540}
- component: {fileID: 1022391539}
m_Layer: 5
m_Name: UIEffect
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1022391538
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1022391537}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1256185}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 50, y: 50}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1022391539
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1022391537}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 938fce054c42f40a3969e27a88d9bdd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ToneFilter: 0
m_ToneIntensity: 1
m_ToneParams: {x: 0, y: 0, z: 0, w: 0}
m_ColorFilter: 0
m_ColorIntensity: 1
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_ColorGlow: 0
m_SamplingFilter: 0
m_SamplingIntensity: 0.5
m_SamplingWidth: 1
m_SamplingScale: 1
m_TransitionFilter: 0
m_TransitionRate: 0.5
m_TransitionReverse: 0
m_TransitionTex: {fileID: 0}
m_TransitionTexScale: {x: 1, y: 1}
m_TransitionTexOffset: {x: 0, y: 0}
m_TransitionTexSpeed: {x: 0, y: 0}
m_TransitionRotation: 0
m_TransitionKeepAspectRatio: 1
m_TransitionWidth: 0.2
m_TransitionSoftness: 0.2
m_TransitionRange:
m_Min: 0
m_Max: 1
m_TransitionColorFilter: 6
m_TransitionColor: {r: 0, g: 0.5, b: 1, a: 1}
m_TransitionColorGlow: 0
m_TransitionPatternReverse: 0
m_TransitionAutoPlaySpeed: 0
m_TargetMode: 0
m_TargetColor: {r: 1, g: 1, b: 1, a: 1}
m_TargetRange: 0.1
m_TargetSoftness: 0.5
m_BlendType: 1
m_SrcBlendMode: 1
m_DstBlendMode: 10
m_ShadowMode: 0
m_ShadowDistance: {x: 1, y: -1}
m_ShadowIteration: 1
m_ShadowFade: 0.9
m_ShadowMirrorScale: 0.5
m_ShadowBlurIntensity: 1
m_ShadowColorFilter: 4
m_ShadowColor: {r: 1, g: 1, b: 1, a: 1}
m_ShadowColorGlow: 0
m_GradationMode: 0
m_GradationColor1: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor2: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor3: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor4: {r: 1, g: 1, b: 1, a: 1}
m_GradationGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2
m_NumAlphaKeys: 2
m_GradationOffset: 0
m_GradationScale: 1
m_GradationRotation: 0
m_AllowToModifyMeshShape: 1
m_EdgeMode: 0
m_EdgeWidth: 0.5
m_EdgeColorFilter: 4
m_EdgeColor: {r: 1, g: 1, b: 1, a: 1}
m_EdgeColorGlow: 0
m_EdgeShinyRate: 0.5
m_EdgeShinyWidth: 0.5
m_EdgeShinyAutoPlaySpeed: 1
m_PatternArea: 1
m_DetailFilter: 4
m_DetailIntensity: 1
m_DetailThreshold:
m_Min: 0
m_Max: 1
m_DetailTex: {fileID: 2800000, guid: e3e220b3071ad46a58b9051928389c6b, type: 3}
m_DetailTexScale: {x: 1, y: 1}
m_DetailTexOffset: {x: 0, y: 0}
m_DetailTexSpeed: {x: 0, y: 0}
m_CustomRoot: {fileID: 1256185}
m_Flip: 0
--- !u!114 &1022391540
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1022391537}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1022391541
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1022391537}
m_CullTransparentMesh: 1
--- !u!1 &1076137586
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1076137589}
- component: {fileID: 1076137588}
- component: {fileID: 1076137587}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1076137587
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1076137586}
m_Enabled: 1
--- !u!20 &1076137588
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1076137586}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.01
far clip plane: 3000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1076137589
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1076137586}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1000, y: 1000, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1303535690
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1303535693}
- component: {fileID: 1303535692}
- component: {fileID: 1303535691}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1303535691
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1303535690}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1303535692
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1303535690}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &1303535693
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1303535690}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1740148341
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1740148343}
- component: {fileID: 1740148342}
- component: {fileID: 1740148344}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &1740148342
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1740148341}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &1740148343
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1740148341}
serializedVersion: 2
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!114 &1740148344
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1740148341}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Version: 1
m_UsePipelineSettings: 1
m_AdditionalLightsShadowResolutionTier: 2
m_LightLayerMask: 1
m_CustomShadowLayers: 0
m_ShadowLayerMask: 1
m_LightCookieSize: {x: 1, y: 1}
m_LightCookieOffset: {x: 0, y: 0}
--- !u!1 &2068343012
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2068343013}
- component: {fileID: 2068343016}
- component: {fileID: 2068343015}
- component: {fileID: 2068343014}
m_Layer: 5
m_Name: UIEffect
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2068343013
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2068343012}
m_LocalRotation: {x: 0.1981076, y: 0.13871644, z: 0.13871644, w: 0.9603483}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 320007022}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2068343014
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2068343012}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 938fce054c42f40a3969e27a88d9bdd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ToneFilter: 0
m_ToneIntensity: 1
m_ToneParams: {x: 0, y: 0, z: 0, w: 0}
m_ColorFilter: 0
m_ColorIntensity: 1
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_ColorGlow: 0
m_SamplingFilter: 0
m_SamplingIntensity: 0.5
m_SamplingWidth: 1
m_SamplingScale: 1
m_TransitionFilter: 0
m_TransitionRate: 0.5
m_TransitionReverse: 0
m_TransitionTex: {fileID: 0}
m_TransitionTexScale: {x: 1, y: 1}
m_TransitionTexOffset: {x: 0, y: 0}
m_TransitionTexSpeed: {x: 0, y: 0}
m_TransitionRotation: 0
m_TransitionKeepAspectRatio: 1
m_TransitionWidth: 0.2
m_TransitionSoftness: 0.2
m_TransitionRange:
m_Min: 0
m_Max: 1
m_TransitionColorFilter: 6
m_TransitionColor: {r: 0, g: 0.5, b: 1, a: 1}
m_TransitionColorGlow: 0
m_TransitionPatternReverse: 0
m_TransitionAutoPlaySpeed: 0
m_TargetMode: 0
m_TargetColor: {r: 1, g: 1, b: 1, a: 1}
m_TargetRange: 0.1
m_TargetSoftness: 0.5
m_BlendType: 1
m_SrcBlendMode: 1
m_DstBlendMode: 10
m_ShadowMode: 0
m_ShadowDistance: {x: 1, y: -1}
m_ShadowIteration: 1
m_ShadowFade: 0.9
m_ShadowMirrorScale: 0.5
m_ShadowBlurIntensity: 1
m_ShadowColorFilter: 4
m_ShadowColor: {r: 1, g: 1, b: 1, a: 1}
m_ShadowColorGlow: 0
m_GradationMode: 0
m_GradationColor1: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor2: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor3: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor4: {r: 1, g: 1, b: 1, a: 1}
m_GradationGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2
m_NumAlphaKeys: 2
m_GradationOffset: 0
m_GradationScale: 1
m_GradationRotation: 0
m_AllowToModifyMeshShape: 1
m_EdgeMode: 0
m_EdgeWidth: 0.5
m_EdgeColorFilter: 4
m_EdgeColor: {r: 1, g: 1, b: 1, a: 1}
m_EdgeColorGlow: 0
m_EdgeShinyRate: 0.5
m_EdgeShinyWidth: 0.5
m_EdgeShinyAutoPlaySpeed: 1
m_PatternArea: 1
m_DetailFilter: 4
m_DetailIntensity: 1
m_DetailThreshold:
m_Min: 0
m_Max: 1
m_DetailTex: {fileID: 2800000, guid: e3e220b3071ad46a58b9051928389c6b, type: 3}
m_DetailTexScale: {x: 1, y: 1}
m_DetailTexOffset: {x: 0, y: 0}
m_DetailTexSpeed: {x: 0, y: 0}
m_CustomRoot: {fileID: 0}
m_Flip: 0
--- !u!114 &2068343015
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2068343012}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &2068343016
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2068343012}
m_CullTransparentMesh: 1
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 320007022}
- {fileID: 1740148343}
- {fileID: 1303535693}
- {fileID: 1076137589}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: fda8f6b673bdc4e84b040385ee78bf83
guid: 36defbd49737346888941c302d8fd96e
DefaultImporter:
externalObjects: {}
userData:
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

+123
View File
@@ -0,0 +1,123 @@
fileFormatVersion: 2
guid: e3e220b3071ad46a58b9051928389c6b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 7cf8e0d1fc8d94fb9944cf32a03c4cfa
guid: 7b8df35684c964c1da889d4128ed94ed
folderAsset: yes
DefaultImporter:
externalObjects: {}
@@ -0,0 +1,63 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-7987516966893236458
MonoBehaviour:
m_ObjectHideFlags: 3
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: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
skipIterations:
m_OverrideState: 0
m_Value: 1
threshold:
m_OverrideState: 1
m_Value: 0.99
intensity:
m_OverrideState: 1
m_Value: 2
scatter:
m_OverrideState: 0
m_Value: 0.7
clamp:
m_OverrideState: 0
m_Value: 65472
tint:
m_OverrideState: 0
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 0
m_Value: 0
downscale:
m_OverrideState: 0
m_Value: 0
maxIterations:
m_OverrideState: 0
m_Value: 6
dirtTexture:
m_OverrideState: 0
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 0
m_Value: 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: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: MultiColorDissolve
m_EditorClassIdentifier:
components:
- {fileID: -7987516966893236458}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 57ac8962e3fd34b1ab7016e803973b51
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,80 @@
using Coffee.UIEffects;
using UnityEngine;
[ExecuteAlways]
public class MultiColorDissolve : MonoBehaviour
{
[SerializeField] private UIEffect m_Base;
[Header("Dissolve 1")]
[SerializeField] private UIEffect m_Dissolve1;
[ColorUsage(true, true)]
[SerializeField]
private Color m_DissolveColor1 = Color.red;
[Range(0, 0.1f)]
[SerializeField]
private float m_Delay1 = 0.05f;
[Range(0, 0.2f)]
[SerializeField]
private float m_Width1 = 0.1f;
[Range(0, 1f)]
[SerializeField]
private float m_Softness1 = 0.5f;
[Header("Dissolve 2")]
[SerializeField]
private UIEffect m_Dissolve2;
[ColorUsage(true, true)]
[SerializeField]
private Color m_DissolveColor2 = Color.magenta;
[Range(0, 0.1f)]
[SerializeField]
private float m_Delay2 = 0.1f;
[Range(0, 0.2f)]
[SerializeField]
private float m_Width2 = 0.1f;
[Range(0, 1f)]
[SerializeField]
private float m_Softness2 = 0.5f;
[Space]
[Range(0, 1)] [SerializeField] private float m_Rate;
public void SetRate(float rate)
{
m_Rate = rate;
if (m_Base)
{
m_Base.transitionRate = rate;
}
if (m_Dissolve1)
{
m_Dissolve1.transitionRate = rate - m_Delay1;
m_Dissolve1.transitionColor = m_DissolveColor1;
m_Dissolve1.transitionWidth = m_Width1;
m_Dissolve1.transitionSoftness = m_Softness1;
}
if (m_Dissolve2)
{
m_Dissolve2.transitionRate = rate - m_Delay2 * 2;
m_Dissolve2.transitionColor = m_DissolveColor2;
m_Dissolve2.transitionWidth = m_Width2;
m_Dissolve2.transitionSoftness = m_Softness2;
}
}
private void OnValidate()
{
SetRate(m_Rate);
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 09ae172f2711c4f2cafc2417dac00d34
guid: 1cb0fa86a0fba445092aa81b4974b7cd
MonoImporter:
externalObjects: {}
serializedVersion: 2
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ba87f0cfb8c4b4eaea328308391c06e5
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 690 KiB

+211 -63
View File
@@ -38,7 +38,6 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.37311924, g: 0.38073963, b: 0.3587269, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
@@ -253,6 +252,7 @@ MonoBehaviour:
m_UseTargetTransform: 1
m_SamplingScale: 1
m_AllowToModifyMeshShape: 1
m_CustomRoot: {fileID: 0}
--- !u!114 &571623417
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -395,6 +395,7 @@ Canvas:
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 27
m_SortingLayerID: 0
m_SortingOrder: 0
@@ -476,7 +477,7 @@ GameObject:
- component: {fileID: 1120943173}
- component: {fileID: 1120943172}
m_Layer: 5
m_Name: UIEffect (1)
m_Name: UIEffect_KeyFeature
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -491,16 +492,16 @@ RectTransform:
m_GameObject: {fileID: 1120943170}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 986199155}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 125, y: -57}
m_SizeDelta: {x: 627.607, y: 970.6}
m_AnchoredPosition: {x: 0, y: -12.107}
m_SizeDelta: {x: 404, y: 512}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1120943172
MonoBehaviour:
@@ -515,93 +516,111 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_ToneFilter: 1
m_ToneIntensity: 0.875
m_ToneIntensity: 0.5
m_ToneParams: {x: 0, y: 0, z: 0, w: 0}
m_ColorFilter: 6
m_ColorIntensity: 0.7
m_Color: {r: 0.745283, g: 0, b: 0.11693734, a: 1}
m_ColorIntensity: 0.5
m_Color: {r: 0.5377358, g: 0, b: 0.09190052, a: 1}
m_ColorGlow: 0
m_SamplingFilter: 5
m_SamplingIntensity: 0.197
m_SamplingFilter: 1
m_SamplingIntensity: 0
m_SamplingWidth: 1
m_SamplingScale: 1
m_TransitionFilter: 3
m_TransitionRate: 0.411
m_TransitionFilter: 8
m_TransitionRate: 0
m_TransitionReverse: 0
m_TransitionTex: {fileID: 2800000, guid: 5a9e7b253d8344331a9ef15185eaa629, type: 3}
m_TransitionTex: {fileID: 2800000, guid: 51cf4ae69d327428fbac4ee73e8587fe, type: 3}
m_TransitionTexScale: {x: 1, y: 1}
m_TransitionTexOffset: {x: 0, y: 0}
m_TransitionRotation: 120
m_TransitionTexSpeed: {x: 0, y: 0}
m_TransitionRotation: 45
m_TransitionKeepAspectRatio: 1
m_TransitionWidth: 0.071
m_TransitionSoftness: 0.401
m_TransitionWidth: 0.5
m_TransitionSoftness: 0.475
m_TransitionRange:
m_Min: 0
m_Max: 1
m_TransitionColorFilter: 6
m_TransitionColor: {r: 0, g: 0.5019608, b: 1.0039216, a: 1}
m_Min: 0.5
m_Max: 0.85
m_TransitionColorFilter: 1
m_TransitionColor: {r: 0, g: 0, b: 0, a: 0.5019608}
m_TransitionColorGlow: 0
m_TransitionPatternReverse: 0
m_TransitionAutoPlaySpeed: 0
m_TargetMode: 0
m_TargetColor: {r: 0.22352943, g: 0.87843144, b: 0.9450981, a: 1}
m_TargetRange: 0.118
m_TargetColor: {r: 0.15686275, g: 0.72156864, b: 0.8509804, a: 1}
m_TargetRange: 0.033
m_TargetSoftness: 0.5
m_BlendType: 1
m_SrcBlendMode: 1
m_DstBlendMode: 10
m_ShadowMode: 0
m_ShadowDistance: {x: 5, y: -5}
m_ShadowIteration: 4
m_ShadowFade: 0.9
m_ShadowMode: 4
m_ShadowDistance: {x: 3, y: -3}
m_ShadowIteration: 2
m_ShadowFade: 0.1
m_ShadowMirrorScale: 0.5
m_ShadowBlurIntensity: 1
m_ShadowColorFilter: 4
m_ShadowColor: {r: 1, g: 1, b: 1, a: 1}
m_ShadowColorGlow: 0
m_GradationMode: 0
m_ShadowColor: {r: 0, g: 1, b: 1, a: 1}
m_ShadowColorGlow: 1
m_GradationMode: 10
m_GradationIntensity: 0.75
m_GradationColorFilter: 1
m_GradationColor1: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor2: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor3: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor4: {r: 1, g: 1, b: 1, a: 1}
m_GradationGradient:
serializedVersion: 2
key0: {r: 1, g: 0, b: 0, a: 1}
key1: {r: 1, g: 0.8571428, b: 0, a: 1}
key2: {r: 0.2857144, g: 1, b: 0, a: 0}
key3: {r: 0, g: 1, b: 0.57142854, a: 0}
key4: {r: 0, g: 0.5714288, b: 1, a: 0}
key5: {r: 0.28571415, g: 0, b: 1, a: 0}
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 0.2857144, g: 1, b: 0, a: 1}
key2: {r: 1, g: 1, b: 1, a: 1}
key3: {r: 0, g: 0.5714288, b: 1, a: 0}
key4: {r: 1, g: 1, b: 1, a: 0}
key5: {r: 1, g: 0, b: 0.8571429, a: 0}
key6: {r: 1, g: 0, b: 0.8571429, a: 0}
key7: {r: 1, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 9830
ctime2: 18724
ctime3: 28720
ctime4: 38165
ctime5: 46838
ctime0: 10879
ctime1: 21823
ctime2: 32768
ctime3: 43646
ctime4: 54591
ctime5: 65535
ctime6: 56173
ctime7: 65535
atime0: 0
atime1: 65535
atime2: 0
atime2: 65535
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 8
m_Mode: 1
m_NumColorKeys: 6
m_NumAlphaKeys: 2
m_GradationOffset: -0.349
m_GradationScale: 0.62374645
m_GradationRotation: 0
m_GradationOffset: 0
m_GradationScale: 0.15
m_GradationRotation: 135
m_AllowToModifyMeshShape: 1
m_EdgeMode: 0
m_EdgeWidth: 0.5
m_EdgeMode: 2
m_EdgeWidth: 0.05
m_EdgeColorFilter: 4
m_EdgeColor: {r: 1, g: 1, b: 1, a: 1}
m_EdgeColor: {r: 1, g: 0.2688679, b: 0.76984084, a: 1}
m_EdgeColorGlow: 0
m_EdgeShinyRate: 0.75
m_EdgeShinyWidth: 0.5
m_EdgeShinySpeed: 1
m_EdgeShinyAutoPlaySpeed: 0
m_PatternArea: 1
m_DetailFilter: 0
m_DetailIntensity: 1
m_DetailThreshold:
m_Min: 0
m_Max: 1
m_DetailTex: {fileID: 0}
m_DetailTexScale: {x: 1, y: 1}
m_DetailTexOffset: {x: 0, y: 0}
m_DetailTexSpeed: {x: 0, y: 0}
m_CustomRoot: {fileID: 0}
m_Flip: 0
--- !u!114 &1120943173
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -654,7 +673,7 @@ GameObject:
- component: {fileID: 1242517206}
- component: {fileID: 1242517205}
m_Layer: 5
m_Name: UIEffect
m_Name: UIEffect_Inspector
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -671,7 +690,8 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 2125393230}
m_Father: {fileID: 986199155}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -718,6 +738,31 @@ MonoBehaviour:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_SeparateReverseCurve: 0
m_ReverseCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 1
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_Delay: 0.5
m_Duration: 1
m_Interval: 0.5
@@ -728,6 +773,9 @@ MonoBehaviour:
m_OnComplete:
m_PersistentCalls:
m_Calls: []
m_OnChangedRate:
m_PersistentCalls:
m_Calls: []
--- !u!114 &1242517206
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -748,7 +796,7 @@ MonoBehaviour:
m_Color: {r: 1, g: 0.08701122, b: 0, a: 1}
m_ColorGlow: 0
m_SamplingFilter: 1
m_SamplingIntensity: 1
m_SamplingIntensity: 0.7
m_SamplingWidth: 1
m_SamplingScale: 1
m_TransitionFilter: 3
@@ -757,6 +805,7 @@ MonoBehaviour:
m_TransitionTex: {fileID: 2800000, guid: 5a9e7b253d8344331a9ef15185eaa629, type: 3}
m_TransitionTexScale: {x: 1, y: 1}
m_TransitionTexOffset: {x: 0, y: 0}
m_TransitionTexSpeed: {x: 0, y: 0}
m_TransitionRotation: 120
m_TransitionKeepAspectRatio: 1
m_TransitionWidth: 0.074
@@ -773,7 +822,7 @@ MonoBehaviour:
m_TargetColor: {r: 0.22352943, g: 0.87843144, b: 0.9450981, a: 1}
m_TargetRange: 0.118
m_TargetSoftness: 0.5
m_BlendType: 1
m_BlendType: 0
m_SrcBlendMode: 1
m_DstBlendMode: 10
m_ShadowMode: 4
@@ -783,11 +832,15 @@ MonoBehaviour:
m_ShadowMirrorScale: 0.5
m_ShadowBlurIntensity: 1
m_ShadowColorFilter: 4
m_ShadowColor: {r: 1, g: 1, b: 1, a: 1}
m_ShadowColor: {r: 0, g: 0, b: 0, a: 1}
m_ShadowColorGlow: 0
m_GradationMode: 2
m_GradationMode: 10
m_GradationIntensity: 1
m_GradationColorFilter: 1
m_GradationColor1: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor2: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor3: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor4: {r: 1, g: 1, b: 1, a: 1}
m_GradationGradient:
serializedVersion: 2
key0: {r: 1, g: 0, b: 0, a: 1}
@@ -817,17 +870,30 @@ MonoBehaviour:
m_Mode: 0
m_NumColorKeys: 8
m_NumAlphaKeys: 2
m_GradationOffset: -0.349
m_GradationScale: 0.62374645
m_GradationRotation: 0
m_GradationOffset: 0
m_GradationScale: 1
m_GradationRotation: 60
m_AllowToModifyMeshShape: 1
m_EdgeMode: 2
m_EdgeWidth: 0.5
m_EdgeColorFilter: 6
m_EdgeColor: {r: 1, g: 1, b: 1, a: 1}
m_EdgeColorGlow: 0
m_EdgeShinyRate: 0.5
m_EdgeShinyWidth: 0.5
m_EdgeShinySpeed: 1
m_EdgeShinyAutoPlaySpeed: 1
m_PatternArea: 1
m_DetailFilter: 1
m_DetailIntensity: 1
m_DetailThreshold:
m_Min: 0.25
m_Max: 0.5
m_DetailTex: {fileID: 2800000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3}
m_DetailTexScale: {x: 1, y: 1}
m_DetailTexOffset: {x: 0, y: 0}
m_DetailTexSpeed: {x: 0, y: 0}
m_CustomRoot: {fileID: 2125393230}
m_Flip: 1
--- !u!114 &1242517207
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -935,6 +1001,7 @@ MonoBehaviour:
m_TransitionTex: {fileID: 0}
m_TransitionTexScale: {x: 1, y: 1}
m_TransitionTexOffset: {x: 0, y: 0}
m_TransitionTexSpeed: {x: 0, y: 0}
m_TransitionRotation: 0
m_TransitionKeepAspectRatio: 1
m_TransitionWidth: 0.2
@@ -964,8 +1031,12 @@ MonoBehaviour:
m_ShadowColor: {r: 1, g: 1, b: 1, a: 1}
m_ShadowColorGlow: 0
m_GradationMode: 0
m_GradationIntensity: 1
m_GradationColorFilter: 1
m_GradationColor1: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor2: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor3: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor4: {r: 1, g: 1, b: 1, a: 1}
m_GradationGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
@@ -1003,9 +1074,22 @@ MonoBehaviour:
m_EdgeWidth: 0.5
m_EdgeColorFilter: 4
m_EdgeColor: {r: 1, g: 1, b: 1, a: 1}
m_EdgeColorGlow: 0
m_EdgeShinyRate: 0.5
m_EdgeShinyWidth: 0.5
m_EdgeShinySpeed: 1
m_EdgeShinyAutoPlaySpeed: 1
m_PatternArea: 1
m_DetailFilter: 0
m_DetailIntensity: 1
m_DetailThreshold:
m_Min: 0
m_Max: 1
m_DetailTex: {fileID: 0}
m_DetailTexScale: {x: 1, y: 1}
m_DetailTexOffset: {x: 0, y: 0}
m_DetailTexSpeed: {x: 0, y: 0}
m_CustomRoot: {fileID: 0}
m_Flip: 0
--- !u!114 &1567169364
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -1082,6 +1166,31 @@ MonoBehaviour:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_SeparateReverseCurve: 0
m_ReverseCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 1
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_Delay: 0.5
m_Duration: 1
m_Interval: 0.5
@@ -1092,3 +1201,42 @@ MonoBehaviour:
m_OnComplete:
m_PersistentCalls:
m_Calls: []
m_OnChangedRate:
m_PersistentCalls:
m_Calls: []
--- !u!1 &2125393229
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2125393230}
m_Layer: 5
m_Name: Root
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2125393230
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2125393229}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1242517204}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2d11887dcfdae4a4faf731ca7777dd28
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,116 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CarterOne-Regular SDF Overlay Mobile
m_Shader: {fileID: 4800000, guid: a02a7d8c237544f1962732b55a9aebf1, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
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: -5656930091445551790, guid: bc6ef582a0efa420683ff976adff235a,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskTex:
m_Texture: {fileID: 0}
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_Ints: []
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
- _MaskEdgeSoftness: 0.01
- _MaskInverse: 0
- _MaskSoftnessX: 0
- _MaskSoftnessY: 0
- _MaskWipeControl: 0.5
- _OutlineSoftness: 0
- _OutlineUVSpeedX: 0
- _OutlineUVSpeedY: 0
- _OutlineWidth: 0
- _PerspectiveFilter: 0.875
- _Reflectivity: 10
- _ScaleRatioA: 0.9
- _ScaleRatioB: 0.73125
- _ScaleRatioC: 0.73125
- _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}
- _MaskEdgeColor: {r: 1, g: 1, b: 1, a: 1}
- _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: 5a5cc54c1f12241ff8d794ef8ca1c16e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,108 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CarterOne-Regular SDF Overlay
m_Shader: {fileID: 4800000, guid: dd89cf5b9246416f84610a006f916af7, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
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: -5656930091445551790, guid: bc6ef582a0efa420683ff976adff235a,
type: 2}
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_Ints: []
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: 0.9
- _ScaleRatioB: 0.73125
- _ScaleRatioC: 0.73125
- _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: cb2000f2042fb4545b8af94316e74dbc
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,116 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CarterOne-Regular SSD Mobile
m_Shader: {fileID: 4800000, guid: c8d12adcee749c344b8117cf7c7eb912, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
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: -5656930091445551790, guid: bc6ef582a0efa420683ff976adff235a,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskTex:
m_Texture: {fileID: 0}
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_Ints: []
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
- _MaskEdgeSoftness: 0.01
- _MaskInverse: 0
- _MaskSoftnessX: 0
- _MaskSoftnessY: 0
- _MaskWipeControl: 0.5
- _OutlineSoftness: 0
- _OutlineUVSpeedX: 0
- _OutlineUVSpeedY: 0
- _OutlineWidth: 0
- _PerspectiveFilter: 0.875
- _Reflectivity: 10
- _ScaleRatioA: 0.9
- _ScaleRatioB: 0.73125
- _ScaleRatioC: 0.73125
- _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}
- _MaskEdgeColor: {r: 1, g: 1, b: 1, a: 1}
- _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: 9426c45abd5c54484b10707936c04ade
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,108 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CarterOne-Regular SSD
m_Shader: {fileID: 4800000, guid: 14eb328de4b8eb245bb7cea29e4ac00b, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
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: -5656930091445551790, guid: bc6ef582a0efa420683ff976adff235a,
type: 2}
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_Ints: []
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: 0.9
- _ScaleRatioB: 0.73125
- _ScaleRatioC: 0.73125
- _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: 06cd8c04a12a94e6084bc44a7e8454f6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -1,74 +0,0 @@
#if UNITY_EDITOR
using System.Diagnostics;
using System.Text;
using UnityEditor;
using UnityEngine;
using Debug = UnityEngine.Debug;
internal static class ImportSample
{
[MenuItem("Development/Import TMP Support V1", false, 2001)]
private static void ImportTMPSupportV1()
{
Run("TextMeshPro Support");
}
[MenuItem("Development/Import TMP Support V2", false, 2002)]
private static void ImportTMPSupportV2()
{
Run("TextMeshPro Support (Unity 6)");
}
[InitializeOnLoadMethod]
private static void ImportSampleOnLoad()
{
#if UNITY_2023_2_OR_NEWER
ImportTMPSupportV2();
#else
ImportTMPSupportV1();
#endif
}
private static void Run(string sample)
{
var p = new Process()
{
StartInfo = new ProcessStartInfo()
{
Arguments = $"import-tmp-support.sh '{sample}'",
CreateNoWindow = true,
#if UNITY_EDITOR_WIN
FileName = @"C:\Program Files (x86)\Git\bin\bash.exe",
#else
FileName = "/bin/bash",
#endif
RedirectStandardError = true,
RedirectStandardOutput = true,
WorkingDirectory = $"{Application.dataPath}/..",
UseShellExecute = false
},
EnableRaisingEvents = true
};
p.Exited += (_, __) =>
{
var result = new StringBuilder();
var stdout = p.StandardOutput.ReadToEnd();
result.Append("stdout: ");
result.Append(stdout);
result.AppendLine();
result.Append("stderr: ");
result.Append(p.StandardError.ReadToEnd());
Debug.Log(result);
if (p.ExitCode == 0 && stdout.StartsWith("Imported: "))
{
var path = stdout.Replace("Imported: ", "").Trim();
AssetDatabase.ImportAsset(path, ImportAssetOptions.ImportRecursive);
}
};
p.Start();
}
}
#endif
@@ -0,0 +1,78 @@
#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using UnityEditor;
using Debug = UnityEngine.Debug;
internal static class TextMeshProSupport
{
private const string k_Version = "userData: v5.8.0";
private const string k_VersionUnity6 = k_Version + " (Unity 6)";
private static readonly Dictionary<string, string> s_FileGuids = new Dictionary<string, string>()
{
{ "Hidden-TMP_Bitmap-Mobile-UIEffect.shader.meta", "guid: 63a1dba10bff94661a909d63808a9a3b" },
{ "Hidden-TMP_Bitmap-UIEffect.shader.meta", "guid: d1cb940e3804b4adcaf9b22083fadfad" },
{ "Hidden-TMP_SDF Overlay-UIEffect.shader.meta", "guid: 03ea49e29b5ad4fbe8e340af208fe8e7" },
{ "Hidden-TMP_SDF SSD-UIEffect.shader.meta", "guid: 26b66f9b09b8d4ac6a2790c3fa8b21c1" },
{ "Hidden-TMP_SDF-Mobile Overlay-UIEffect.shader.meta", "guid: 16f26337621974eaf998b9857bac39c6" },
{ "Hidden-TMP_SDF-Mobile SSD-UIEffect.shader.meta", "guid: 2c69b4dabb5c24ae99889f581c8b556a" },
{ "Hidden-TMP_SDF-Mobile-UIEffect.shader.meta", "guid: e65241fa80a374114b3f55ed746c04d9" },
{ "Hidden-TMP_SDF-UIEffect.shader.meta", "guid: 935b7be1c88464d2eb87204fdfab5a38" }
};
[MenuItem("Development/TextMeshPro/", false, -40)]
private static void _()
{
}
[MenuItem("Development/TextMeshPro/List GUID, Version for TMP Samples", false)]
private static void ListGuidsAndVersions()
{
var sb = new StringBuilder();
ForEachMeta(x =>
{
var (path, guid, version) = x;
sb.AppendLine($"{guid},\tversion: {version},\t{Path.GetFileName(path)}");
});
Debug.Log(sb);
}
[MenuItem("Development/TextMeshPro/Update GUID, Version for TMP Samples", false)]
private static void UpdateGuidsAndVersions()
{
ForEachMeta(x =>
{
var (path, guid, version) = x;
var fileName = Path.GetFileName(path);
s_FileGuids.TryGetValue(fileName.Replace("-Unity6", ""), out var expectedGuid);
var expectedVersion = path.Contains("-Unity6") ? k_VersionUnity6 : k_Version;
if (expectedGuid != guid || expectedVersion != version)
{
Debug.Log($"Update: {fileName}");
var meta = File.ReadAllText(path);
File.WriteAllText(path, meta.Replace(guid, expectedGuid).Replace(version, expectedVersion));
}
});
}
private static void ForEachMeta(Action<(string path, string guid, string version)> action)
{
foreach (var p in Directory.GetFiles("Packages/src/Samples~", "*.shader.meta", SearchOption.AllDirectories))
{
var fileName = Path.GetFileName(p);
if (!fileName.Contains("TMP_")) continue;
var meta = File.ReadAllText(p);
var guid = Regex.Match(meta, @"(guid: \w+)$", RegexOptions.Multiline).Groups[1].Value;
var version = Regex.Match(meta, @"(userData: .*)$", RegexOptions.Multiline).Groups[1].Value;
action((p, guid, version));
}
}
}
#endif
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 23cc1f211cd264050a641c01c4a6d77a
guid: 8d415f5270a5d45608931175d5835110
MonoImporter:
externalObjects: {}
serializedVersion: 2
@@ -123,6 +123,43 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &10648190
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 10648191}
m_Layer: 5
m_Name: Overlay Mobile
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &10648191
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 10648190}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1104939386}
m_Father: {fileID: 795204878}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &35634202
GameObject:
m_ObjectHideFlags: 0
@@ -485,7 +522,7 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 114739998}
m_CullTransparentMesh: 1
--- !u!1 &368143712
--- !u!1 &162579139
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@@ -493,34 +530,302 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 368143713}
- component: {fileID: 162579140}
- component: {fileID: 162579143}
- component: {fileID: 162579142}
- component: {fileID: 162579141}
m_Layer: 5
m_Name: Space
m_Name: TITLE
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &368143713
--- !u!224 &162579140
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 368143712}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_GameObject: {fileID: 162579139}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 795204878}
m_RootOrder: 4
m_Father: {fileID: 779059310}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0.000015258789, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &162579141
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 162579139}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bcd162ab5f95d4f82a841acc1e950418, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Target: {fileID: 1887047861}
m_UseTargetTransform: 0
m_SamplingScale: 1
m_AllowToModifyMeshShape: 1
--- !u!114 &162579142
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 162579139}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: SSD
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: bc6ef582a0efa420683ff976adff235a, type: 2}
m_sharedMaterial: {fileID: 2100000, guid: 06cd8c04a12a94e6084bc44a7e8454f6, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 71.4
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 100
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 0
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &162579143
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 162579139}
m_CullTransparentMesh: 1
--- !u!1 &252380787
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 252380788}
- component: {fileID: 252380791}
- component: {fileID: 252380790}
- component: {fileID: 252380789}
m_Layer: 5
m_Name: TITLE
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &252380788
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 252380787}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1563788056}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0.000015258789, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &252380789
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 252380787}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bcd162ab5f95d4f82a841acc1e950418, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Target: {fileID: 1887047861}
m_UseTargetTransform: 0
m_SamplingScale: 1
m_AllowToModifyMeshShape: 1
--- !u!114 &252380790
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 252380787}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Overlay
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: bc6ef582a0efa420683ff976adff235a, type: 2}
m_sharedMaterial: {fileID: 2100000, guid: cb2000f2042fb4545b8af94316e74dbc, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 71.4
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 100
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 0
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &252380791
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 252380787}
m_CullTransparentMesh: 1
--- !u!21 &509591527
Material:
serializedVersion: 8
@@ -715,6 +1020,43 @@ MonoBehaviour:
m_UseTargetTransform: 0
m_SamplingScale: 1
m_AllowToModifyMeshShape: 1
--- !u!1 &622625912
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 622625913}
m_Layer: 5
m_Name: SSD Mobile
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &622625913
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 622625912}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 790108298}
m_Father: {fileID: 795204878}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &632405357
GameObject:
m_ObjectHideFlags: 0
@@ -842,6 +1184,195 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 632405357}
m_CullTransparentMesh: 1
--- !u!1 &779059309
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 779059310}
m_Layer: 5
m_Name: SSD
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &779059310
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 779059309}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 162579140}
m_Father: {fileID: 795204878}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &790108297
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 790108298}
- component: {fileID: 790108301}
- component: {fileID: 790108300}
- component: {fileID: 790108299}
m_Layer: 5
m_Name: TITLE
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &790108298
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 790108297}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 622625913}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &790108299
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 790108297}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bcd162ab5f95d4f82a841acc1e950418, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Target: {fileID: 1887047861}
m_UseTargetTransform: 0
m_SamplingScale: 1
m_AllowToModifyMeshShape: 1
--- !u!114 &790108300
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 790108297}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: SSD Mobile
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: bc6ef582a0efa420683ff976adff235a, type: 2}
m_sharedMaterial: {fileID: 2100000, guid: 9426c45abd5c54484b10707936c04ade, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 71.25
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 100
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 0
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &790108301
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 790108297}
m_CullTransparentMesh: 1
--- !u!1 &795204877
GameObject:
m_ObjectHideFlags: 0
@@ -878,7 +1409,10 @@ RectTransform:
- {fileID: 1489226064}
- {fileID: 1044616015}
- {fileID: 1530152937}
- {fileID: 368143713}
- {fileID: 1563788056}
- {fileID: 10648191}
- {fileID: 779059310}
- {fileID: 622625913}
m_Father: {fileID: 1887047860}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -1261,6 +1795,158 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1104939385
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1104939386}
- component: {fileID: 1104939389}
- component: {fileID: 1104939388}
- component: {fileID: 1104939387}
m_Layer: 5
m_Name: TITLE
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1104939386
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1104939385}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 10648191}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1104939387
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1104939385}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bcd162ab5f95d4f82a841acc1e950418, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Target: {fileID: 1887047861}
m_UseTargetTransform: 0
m_SamplingScale: 1
m_AllowToModifyMeshShape: 1
--- !u!114 &1104939388
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1104939385}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Overlay Mobile
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: bc6ef582a0efa420683ff976adff235a, type: 2}
m_sharedMaterial: {fileID: 2100000, guid: 5a5cc54c1f12241ff8d794ef8ca1c16e, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 52
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 100
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 0
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &1104939389
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1104939385}
m_CullTransparentMesh: 1
--- !u!1 &1339549413
GameObject:
m_ObjectHideFlags: 0
@@ -1447,6 +2133,43 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1563788055
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1563788056}
m_Layer: 5
m_Name: Overlay
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1563788056
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1563788055}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 252380788}
m_Father: {fileID: 795204878}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1612340793
GameObject:
m_ObjectHideFlags: 0
@@ -1649,6 +2372,8 @@ MonoBehaviour:
m_GradationMode: 0
m_GradationColor1: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor2: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor3: {r: 1, g: 1, b: 1, a: 1}
m_GradationColor4: {r: 1, g: 1, b: 1, a: 1}
m_GradationGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
@@ -1686,6 +2411,7 @@ MonoBehaviour:
m_EdgeWidth: 0.5
m_EdgeColorFilter: 4
m_EdgeColor: {r: 1, g: 1, b: 1, a: 1}
m_EdgeShinyRate: 0.5
m_EdgeShinyWidth: 0.5
m_EdgeShinyAutoPlaySpeed: 1
m_PatternArea: 1
@@ -1723,13 +2449,13 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1887047859}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding: {x: 0, y: 0, z: 0, w: 0}
m_Softness: {x: 0, y: 0}
m_Softness: {x: 500, y: 0}
--- !u!1 &1932217252
GameObject:
m_ObjectHideFlags: 0
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b679dead51ca64e93a87fbd98e1dbaf5
guid: 14bf4da62b8434d7ca6e6a7e8b63e4ea
folderAsset: yes
DefaultImporter:
externalObjects: {}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 43c4f102824e943cf859c0d6c966b9fa
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: bb16138913ad1451aa438c3edd486c67
guid: c00285a6a9d0843f4a7da23d7dda6582
folderAsset: yes
DefaultImporter:
externalObjects: {}
+27
View File
@@ -0,0 +1,27 @@
using UnityEditor;
internal static class UserDataEditor
{
[InitializeOnLoadMethod]
private static void InitializeOnLoadMethod()
{
Editor.finishedDefaultHeaderGUI += OnFinishedDefaultHeaderGUI;
}
private static void OnFinishedDefaultHeaderGUI(Editor editor)
{
var importer = editor.target as AssetImporter;
if (!importer)
{
if (!AssetDatabase.Contains(editor.target)) return;
importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(editor.target));
}
if (!importer) return;
EditorGUIUtility.labelWidth = 55;
importer.userData = EditorGUILayout.DelayedTextField("userdata", importer.userData);
AssetDatabase.WriteImportSettingsIfDirty(importer.assetPath);
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3fbf547b561114807adbec486aa2b977
guid: 92afd1c51675640e88e3abb238cd225f
MonoImporter:
externalObjects: {}
serializedVersion: 2
File diff suppressed because it is too large Load Diff
@@ -8,75 +8,105 @@ ShaderVariantCollection:
m_PrefabAsset: {fileID: 0}
m_Name: UIEffectShaderVariants
m_Shaders:
- first: {fileID: 4800000, guid: 935b7be1c88464d2eb87204fdfab5a38, type: 3}
second:
variants:
- keywords: COLOR_FILTER GLOW_ON GRADATION_GRADIENT UNDERLAY_ON
passType: 0
- keywords: COLOR_FILTER GLOW_ON TRANSITION_BURN UNDERLAY_ON
passType: 0
- keywords: COLOR_FILTER GLOW_ON UNDERLAY_ON
passType: 0
- keywords: EDGE_PLAIN GLOW_ON UNDERLAY_ON
passType: 0
- keywords: GLOW_ON SAMPLING_BLUR_DETAIL UNDERLAY_ON
passType: 0
- keywords: GLOW_ON SAMPLING_EDGE_LUMINANCE UNDERLAY_ON
passType: 0
- keywords: GLOW_ON SAMPLING_PIXELATION TONE_RETRO UNDERLAY_ON
passType: 0
- keywords: GLOW_ON SAMPLING_PIXELATION UNDERLAY_ON
passType: 0
- keywords: GLOW_ON SAMPLING_RGB_SHIFT UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TONE_RETRO UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_BURN UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_DISSOLVE UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_MELT UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_PATTERN UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_SHINY UNDERLAY_ON
passType: 0
- first: {fileID: 4800000, guid: 96246b1ead49a4c5a996fd477bc5a117, type: 3}
second:
variants:
- keywords:
passType: 0
- keywords: COLOR_ADDITIVE
- keywords: COLOR_FILTER
passType: 0
- keywords: COLOR_CONTRAST
- keywords: COLOR_FILTER EDGE_PLAIN
passType: 0
- keywords: COLOR_HSV_MODIFIER
- keywords: COLOR_FILTER EDGE_PLAIN TRANSITION_PATTERN
passType: 0
- keywords: COLOR_HSV_MODIFIER TARGET_HUE
- keywords: COLOR_FILTER EDGE_SHINY
passType: 0
- keywords: COLOR_HSV_MODIFIER TARGET_LUMINANCE
- keywords: COLOR_FILTER SAMPLING_BLUR_FAST
passType: 0
- keywords: COLOR_MULTIPLY
- keywords: COLOR_FILTER SAMPLING_BLUR_FAST TONE_GRAYSCALE
passType: 0
- keywords: COLOR_MULTIPLY SHADOW_COLOR_REPLACE
- keywords: COLOR_FILTER SAMPLING_BLUR_FAST TONE_GRAYSCALE TRANSITION_DISSOLVE
passType: 0
- keywords: COLOR_MULTIPLY_ADDITIVE
- keywords: COLOR_FILTER TARGET_HUE
passType: 0
- keywords: COLOR_MULTIPLY_ADDITIVE SAMPLING_BLUR_FAST TONE_GRAYSCALE TRANSITION_COLOR_MULTIPLY_ADDITIVE
TRANSITION_DISSOLVE
- keywords: COLOR_FILTER TARGET_LUMINANCE
passType: 0
- keywords: COLOR_MULTIPLY_LUMINANCE
- keywords: COLOR_FILTER TRANSITION_MELT
passType: 0
- keywords: COLOR_REPLACE
- keywords: DETAIL_ADDITIVE
passType: 0
- keywords: COLOR_SUBTRACTIVE
- keywords: DETAIL_MASKING
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_PLAIN
- keywords: DETAIL_MULTIPLY
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_PLAIN SHADOW_COLOR_MULTIPLY_ADDITIVE
- keywords: DETAIL_MULTIPLY_ADDITIVE
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_SHINY
- keywords: DETAIL_REPLACE
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_SHINY SAMPLING_EDGE_ALPHA
- keywords: DETAIL_SUBTRACTIVE
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_SHINY SHADOW_COLOR_MULTIPLY_ADDITIVE
- keywords: EDGE_PLAIN
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_SHINY TRANSITION_COLOR_MULTIPLY
TRANSITION_PATTERN
- keywords: EDGE_PLAIN TRANSITION_PATTERN
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_SHINY TRANSITION_COLOR_MULTIPLY_ADDITIVE
TRANSITION_PATTERN
- keywords: EDGE_SHINY
passType: 0
- keywords: EDGE_PLAIN SHADOW_COLOR_REPLACE TRANSITION_COLOR_MULTIPLY TRANSITION_PATTERN
- keywords: EDGE_SHINY SAMPLING_EDGE_ALPHA
passType: 0
- keywords: EDGE_PLAIN TRANSITION_COLOR_MULTIPLY TRANSITION_PATTERN
- keywords: EDGE_SHINY TRANSITION_PATTERN
passType: 0
- keywords: GRADATION_COLOR2
passType: 0
- keywords: GRADATION_COLOR4
passType: 0
- keywords: GRADATION_GRADIENT
passType: 0
- keywords: GRADATION_RADIAL
passType: 0
- keywords: SAMPLING_BLUR_DETAIL
passType: 0
- keywords: SAMPLING_BLUR_FAST
passType: 0
- keywords: SAMPLING_BLUR_FAST SHADOW_COLOR_MULTIPLY_ADDITIVE
passType: 0
- keywords: SAMPLING_BLUR_FAST SHADOW_COLOR_MULTIPLY_ADDITIVE UNITY_UI_CLIP_RECT
passType: 0
- keywords: SAMPLING_BLUR_FAST SHADOW_COLOR_REPLACE
passType: 0
- keywords: SAMPLING_BLUR_FAST SHADOW_COLOR_REPLACE TONE_GRAYSCALE
passType: 0
- keywords: SAMPLING_BLUR_MEDIUM
passType: 0
- keywords: SAMPLING_EDGE_ALPHA
passType: 0
- keywords: SAMPLING_EDGE_LUMINANCE
passType: 0
- keywords: SAMPLING_EDGE_LUMINANCE TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_MASK
- keywords: SAMPLING_EDGE_LUMINANCE TRANSITION_MASK
passType: 0
- keywords: SAMPLING_PIXELATION
passType: 0
@@ -86,8 +116,6 @@ ShaderVariantCollection:
passType: 0
- keywords: SAMPLING_RGB_SHIFT
passType: 0
- keywords: SHADOW_COLOR_REPLACE
passType: 0
- keywords: TONE_GRAYSCALE
passType: 0
- keywords: TONE_NEGATIVE
@@ -98,107 +126,31 @@ ShaderVariantCollection:
passType: 0
- keywords: TONE_SEPIA
passType: 0
- keywords: TRANSITION_BURN TRANSITION_COLOR_MULTIPLY_ADDITIVE
- keywords: TRANSITION_BURN
passType: 0
- keywords: TRANSITION_BURN TRANSITION_COLOR_MULTIPLY_ADDITIVE UNITY_UI_CLIP_RECT
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY TRANSITION_PATTERN
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_DISSOLVE
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_DISSOLVE UNITY_UI_CLIP_RECT
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_MASK
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_MELT
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_MELT UNITY_UI_CLIP_RECT
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_PATTERN
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_SHINY
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_SHINY UNITY_UI_CLIP_RECT
passType: 0
- keywords: TRANSITION_COLOR_REPLACE TRANSITION_MELT
- keywords: TRANSITION_BURN UNITY_UI_CLIP_RECT
passType: 0
- keywords: TRANSITION_CUTOFF
passType: 0
- keywords: TRANSITION_DISSOLVE
passType: 0
- keywords: TRANSITION_DISSOLVE UNITY_UI_CLIP_RECT
passType: 0
- keywords: TRANSITION_FADE
passType: 0
- first: {fileID: 4800000, guid: e65241fa80a374114b3f55ed746c04d9, type: 3}
second:
variants:
- keywords: SAMPLING_RGB_SHIFT TONE_RETRO TRANSITION_COLOR_MULTIPLY_ADDITIVE
TRANSITION_SHINY
- keywords: TRANSITION_MASK
passType: 0
- keywords: SAMPLING_RGB_SHIFT TRANSITION_CUTOFF
- keywords: TRANSITION_MELT
passType: 0
- first: {fileID: 4800000, guid: 935b7be1c88464d2eb87204fdfab5a38, type: 3}
second:
variants:
- keywords: COLOR_HSV_MODIFIER GLOW_ON UNDERLAY_ON
- keywords: TRANSITION_MELT UNITY_UI_CLIP_RECT
passType: 0
- keywords: EDGE_COLOR_REPLACE EDGE_PLAIN GLOW_ON UNDERLAY_ON
- keywords: TRANSITION_PATTERN
passType: 0
- keywords: EDGE_COLOR_REPLACE EDGE_SHINY GLOW_ON UNDERLAY_ON
- keywords: TRANSITION_PATTERN UNITY_UI_CLIP_RECT
passType: 0
- keywords: GLOW_ON SAMPLING_BLUR_DETAIL UNDERLAY_ON
- keywords: TRANSITION_SHINY
passType: 0
- keywords: GLOW_ON SAMPLING_BLUR_FAST SHADOW_COLOR_MULTIPLY_ADDITIVE UNDERLAY_ON
passType: 0
- keywords: GLOW_ON SAMPLING_EDGE_LUMINANCE UNDERLAY_ON
passType: 0
- keywords: GLOW_ON SAMPLING_PIXELATION UNDERLAY_ON
passType: 0
- keywords: GLOW_ON SAMPLING_RGB_SHIFT UNDERLAY_ON
passType: 0
- keywords: GLOW_ON SHADOW_COLOR_REPLACE TRANSITION_BURN TRANSITION_COLOR_MULTIPLY_ADDITIVE
UNDERLAY_ON
passType: 0
- keywords: GLOW_ON SHADOW_COLOR_REPLACE UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TONE_RETRO UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_BURN TRANSITION_COLOR_MULTIPLY_ADDITIVE UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_COLOR_MULTIPLY TRANSITION_PATTERN UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_DISSOLVE
UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_MELT UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_PATTERN UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_SHINY UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_COLOR_REPLACE TRANSITION_MELT UNDERLAY_ON
passType: 0
- keywords: GLOW_ON UNDERLAY_ON
passType: 0
- keywords: SAMPLING_PIXELATION TONE_RETRO
passType: 0
- keywords: SAMPLING_RGB_SHIFT TONE_RETRO TRANSITION_COLOR_MULTIPLY_ADDITIVE
TRANSITION_SHINY
passType: 0
- keywords: SAMPLING_RGB_SHIFT TRANSITION_CUTOFF
passType: 0
- first: {fileID: 4800000, guid: d1cb940e3804b4adcaf9b22083fadfad, type: 3}
second:
variants:
- keywords: SAMPLING_RGB_SHIFT TONE_RETRO TRANSITION_COLOR_MULTIPLY_ADDITIVE
TRANSITION_SHINY
passType: 0
- keywords: SAMPLING_RGB_SHIFT TRANSITION_CUTOFF
passType: 0
- first: {fileID: 4800000, guid: 63a1dba10bff94661a909d63808a9a3b, type: 3}
second:
variants:
- keywords: SAMPLING_RGB_SHIFT TONE_RETRO TRANSITION_COLOR_MULTIPLY_ADDITIVE
TRANSITION_SHINY
passType: 0
- keywords: SAMPLING_RGB_SHIFT TRANSITION_CUTOFF
- keywords: TRANSITION_SHINY UNITY_UI_CLIP_RECT
passType: 0
--- !u!114 &11400000
MonoBehaviour:
@@ -212,14 +164,32 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7d43f626d9b5f4d729097092ded48bdb, type: 3}
m_Name: UIEffectProjectSettings
m_EditorClassIdentifier:
m_TransformSensitivity: 1
m_RuntimePresets:
- {fileID: 1645081683573595507, guid: 3b09ad143990c4c8795c6e93760e132a, type: 3}
- {fileID: 1645081683573595507, guid: 4f70ff0f1e25b4388b9bcb38d619f7bf, type: 3}
m_RuntimePresets: []
m_RuntimePresetsV2:
- {fileID: 11400000, guid: 460881a8263ce454799a8c689c28d8c9, type: 2}
- {fileID: 11400000, guid: b919bc84de9254bcf8f614d392db83bb, type: 2}
m_UseHDRColorPicker: 1
m_ShaderVariantCollection: {fileID: -8740588384831342173}
m_ShaderVariantRegistry:
m_OptionalShaders: []
m_OptionalShaders:
- key: Hidden/TextMeshPro/Bitmap (SoftMaskable)
value: Hidden/TextMeshPro/Bitmap (UIEffect)
- key: Hidden/TextMeshPro/Distance Field (SoftMaskable)
value: Hidden/TextMeshPro/Distance Field (UIEffect)
- key: Hidden/TextMeshPro/Distance Field Overlay (SoftMaskable)
value: Hidden/TextMeshPro/Distance Field Overlay (UIEffect)
- key: Hidden/TextMeshPro/Distance Field SSD (SoftMaskable)
value: Hidden/TextMeshPro/Distance Field SSD (UIEffect)
- key: Hidden/TextMeshPro/Mobile/Bitmap (SoftMaskable)
value: Hidden/TextMeshPro/Mobile/Bitmap (UIEffect)
- key: Hidden/TextMeshPro/Mobile/Distance Field (SoftMaskable)
value: Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)
- key: Hidden/TextMeshPro/Mobile/Distance Field Overlay (SoftMaskable)
value: Hidden/TextMeshPro/Mobile/Distance Field Overlay (UIEffect)
- key: Hidden/TextMeshPro/Mobile/Distance Field SSD (SoftMaskable)
value: Hidden/TextMeshPro/Mobile/Distance Field SSD (UIEffect)
- key: Hidden/UI/Default (SoftMaskable)
value: Hidden/UI/Default (UIEffect)
m_Asset: {fileID: -8740588384831342173}
m_ErrorOnUnregisteredVariant: 0
m_UnregisteredVariants: []
+1
View File
@@ -0,0 +1 @@
./Packages/src/CHANGELOG.md
+2 -1
View File
@@ -3,7 +3,8 @@
"com.coffee.development": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/Development",
"com.coffee.minimal-resource": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/MinimalResource",
"com.coffee.nano-monitor": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
"com.unity.ide.rider": "3.0.34",
"com.coffee.symbolic-linker": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/SymbolicLinker",
"com.unity.ide.rider": "3.0.36",
"com.unity.test-framework": "1.1.33",
"com.unity.textmeshpro": "3.0.9",
"com.unity.modules.animation": "1.0.0"
+11 -4
View File
@@ -5,14 +5,14 @@
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "2045eaab5b485827cef8bf0bb9e1552dce4f8d6d"
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
},
"com.coffee.minimal-resource": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/MinimalResource",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "2045eaab5b485827cef8bf0bb9e1552dce4f8d6d"
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
},
"com.coffee.nano-monitor": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
@@ -21,7 +21,14 @@
"dependencies": {
"com.unity.ugui": "1.0.0"
},
"hash": "2045eaab5b485827cef8bf0bb9e1552dce4f8d6d"
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
},
"com.coffee.symbolic-linker": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/SymbolicLinker",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "4a182298bd6293c4e6e33dd40bb7a050847190d8"
},
"com.coffee.ui-effect": {
"version": "file:src",
@@ -39,7 +46,7 @@
"url": "https://packages.unity.com"
},
"com.unity.ide.rider": {
"version": "3.0.34",
"version": "3.0.36",
"depth": 0,
"source": "registry",
"dependencies": {
+144
View File
@@ -1,3 +1,147 @@
## [5.8.4](https://github.com/mob-sakai/UIEffect/compare/5.8.3...5.8.4) (2025-04-30)
### Bug Fixes
* NRE while canvas is disabled ([a3773e3](https://github.com/mob-sakai/UIEffect/commit/a3773e33028c60517fb4e6c534f6280194df8e64)), closes [#342](https://github.com/mob-sakai/UIEffect/issues/342)
## [5.8.3](https://github.com/mob-sakai/UIEffect/compare/5.8.2...5.8.3) (2025-04-30)
### Bug Fixes
* the alpha of the gradation color and gradient was being ignored ([3807e4c](https://github.com/mob-sakai/UIEffect/commit/3807e4c69aefaef04b2245522e7c5085ccc65a36)), closes [#341](https://github.com/mob-sakai/UIEffect/issues/341)
## [5.8.2](https://github.com/mob-sakai/UIEffect/compare/5.8.1...5.8.2) (2025-04-23)
### Bug Fixes
* `Flip` is ignored when loading a preset ([e1f3abf](https://github.com/mob-sakai/UIEffect/commit/e1f3abf7a65b62718b28e33ac2f7d700c3ae3f5a))
* fix detail color ([90ab16c](https://github.com/mob-sakai/UIEffect/commit/90ab16c3fd46435ebf7c8e47ffb4ec521d2f61c9))
* indicate in the inspector using tooltips and asterisks that `Rotation` and `Keep Aspect Ratio` are shared properties ([2cca822](https://github.com/mob-sakai/UIEffect/commit/2cca822413aa7580e1eb777c3295d1de928cd65f))
## [5.8.1](https://github.com/mob-sakai/UIEffect/compare/5.8.0...5.8.1) (2025-04-17)
### Bug Fixes
* built-in presets cannot be used with `UIEffectReplica` ([1106f4b](https://github.com/mob-sakai/UIEffect/commit/1106f4bf4632e1372d44ced9a38e98209a6b55e8))
* New presets ignore `DetailColor` property ([1143fbb](https://github.com/mob-sakai/UIEffect/commit/1143fbb84a1e08817de93f1349ee5cdad0972db5)), closes [#336](https://github.com/mob-sakai/UIEffect/issues/336)
* prevent built-in preset assets from being editable ([0898d73](https://github.com/mob-sakai/UIEffect/commit/0898d730add42970fb74bf2ad8aca9809bf6dd39))
# [5.8.0](https://github.com/mob-sakai/UIEffect/compare/5.7.0...5.8.0) (2025-04-17)
### Bug Fixes
* `ShadowMode.Mirror` does not flip the effect ([37daad0](https://github.com/mob-sakai/UIEffect/commit/37daad01c4f3f4c259650b1493aeae204e0bd247))
* fix alpha clipping for ShaderGraph ([ae177a8](https://github.com/mob-sakai/UIEffect/commit/ae177a800cba1561b523292279d7986d4eff9f9c))
* unable to add editor presets as runtime presets to project settings ([726bb10](https://github.com/mob-sakai/UIEffect/commit/726bb100a0ad327619634ea73ccdccc36276d0d0)), closes [#330](https://github.com/mob-sakai/UIEffect/issues/330)
### Features
* add `DetailColor` property ([30bf783](https://github.com/mob-sakai/UIEffect/commit/30bf783320398d68b90b09b0dcf93738b4683e00)), closes [#332](https://github.com/mob-sakai/UIEffect/issues/332)
* ScriptableObject based preset system ([f8682f3](https://github.com/mob-sakai/UIEffect/commit/f8682f3c9889fb56ff3cd9010934f998e121553a)), closes [#333](https://github.com/mob-sakai/UIEffect/issues/333)
# [5.7.0](https://github.com/mob-sakai/UIEffect/compare/5.6.4...5.7.0) (2025-04-11)
### Bug Fixes
* colors appeared darker when alpha was low ([21172f3](https://github.com/mob-sakai/UIEffect/commit/21172f37c21792906ac9e33827c771d388397653))
* shrink shader variants for color filters ([7f60a56](https://github.com/mob-sakai/UIEffect/commit/7f60a56a9af6b4ecee223b466f1b2499af0194f4))
### Features
* `UIEffectReplica.flip` has been deprecated ([6af34e2](https://github.com/mob-sakai/UIEffect/commit/6af34e2994378fd33025b41fe08898b552aa08ab))
* add `GradationIntensity` and `GradationColorFilter` properties ([a6781b9](https://github.com/mob-sakai/UIEffect/commit/a6781b92899c38f49eccfebf4173028955a5aced))
* calculate the normalized position on the shader side ([01bbeed](https://github.com/mob-sakai/UIEffect/commit/01bbeedde7cf2d757d6d295475f0ad9acd24dce3)), closes [#323](https://github.com/mob-sakai/UIEffect/issues/323) [#324](https://github.com/mob-sakai/UIEffect/issues/324)
* ShaderGraph support ([2dd2e26](https://github.com/mob-sakai/UIEffect/commit/2dd2e261666b611be3a1fd5ac112db34fd99038e)), closes [#326](https://github.com/mob-sakai/UIEffect/issues/326)
## [5.6.4](https://github.com/mob-sakai/UIEffect/compare/5.6.3...5.6.4) (2025-04-10)
### Bug Fixes
* avoid potential allocations ([26da24d](https://github.com/mob-sakai/UIEffect/commit/26da24dbc4022dcd71e7a58e5f02a6922ba2ddff))
* optional shaders do not support all shader combinations ([6014ab5](https://github.com/mob-sakai/UIEffect/commit/6014ab54d010872f8fee63fc961ac5ab2edd08e1))
## [5.6.3](https://github.com/mob-sakai/UIEffect/compare/5.6.2...5.6.3) (2025-04-06)
### Bug Fixes
* fix a potential `ArgumentOutOfRangeException` that could occur when changing the FontAsset in TextMeshPro ([3b095bc](https://github.com/mob-sakai/UIEffect/commit/3b095bcebd8b1264c373b8b71c27d3c35f673f3b)), closes [#327](https://github.com/mob-sakai/UIEffect/issues/327)
## [5.6.2](https://github.com/mob-sakai/UIEffect/compare/5.6.1...5.6.2) (2025-04-04)
### Bug Fixes
* fix a potential `ArgumentOutOfRangeException` that could occur when changing the FontAsset in TextMeshPro ([909281c](https://github.com/mob-sakai/UIEffect/commit/909281c66b702d8497e9f847c91b688716b9c6a7)), closes [#327](https://github.com/mob-sakai/UIEffect/issues/327)
* Remove unnecessary vertex expansion ([974e3e8](https://github.com/mob-sakai/UIEffect/commit/974e3e8769d456c5cdd8eb1767a7cf57ab4d52fc))
* undo now works correctly after clicking the 'Clear' button in the inspector ([75ed355](https://github.com/mob-sakai/UIEffect/commit/75ed355e27faf8962390eb6788e1887ffd1b5f89))
## [5.6.1](https://github.com/mob-sakai/UIEffect/compare/5.6.0...5.6.1) (2025-03-28)
### Bug Fixes
* changes were not correctly marked as dirty when loading presets ([76be0fc](https://github.com/mob-sakai/UIEffect/commit/76be0fc860c27b89235b7fb9a766dcc38b3d9924))
# [5.6.0](https://github.com/mob-sakai/UIEffect/compare/5.5.3...5.6.0) (2025-03-28)
### Bug Fixes
* fix edge detection ([9462170](https://github.com/mob-sakai/UIEffect/commit/946217069f10714798070481d8576f5470e243db))
* fix project settings icon ([202601c](https://github.com/mob-sakai/UIEffect/commit/202601c96d6fb564ee5d6b8868b0ff0a8dba0ba1))
* the strength of ColorGlow, TransitionColorGlow, and ShadowColorGlow now changes according to intensity ([aa4ec8d](https://github.com/mob-sakai/UIEffect/commit/aa4ec8d9c449bfe361aa277e25cbb389e0daa983)), closes [#316](https://github.com/mob-sakai/UIEffect/issues/316)
* UIEffect with TextMeshPro SubMeshUI appears black in the editor when saving assets ([de91871](https://github.com/mob-sakai/UIEffect/commit/de918718d062979c8e9b4202b6b2ae389ae10bab))
### Features
* `TransitionAutoPlaySpeed`, `TransitionTexSpeed`, and `EdgeShinyAutoPlaySpeed` are previewed only when the object is selected in edit mode ([952a94f](https://github.com/mob-sakai/UIEffect/commit/952a94f50b3ae4279a48b03d019f341e46b2f5b7)), closes [#319](https://github.com/mob-sakai/UIEffect/issues/319)
* add 'Flip' feature ([def49c3](https://github.com/mob-sakai/UIEffect/commit/def49c34f5b963c8b0cce6fb8cace3f7d93b5a1e))
* add `Detail Filter` feature ([3e2c5c1](https://github.com/mob-sakai/UIEffect/commit/3e2c5c1613d9a2c08487d94c4eef28f066f2eb7b))
* add `EdgeColorGlow` option ([53db1e6](https://github.com/mob-sakai/UIEffect/commit/53db1e62546384f04b9c526df2623c4598dd34bf))
* add `onChangeRate` event for UIEffectTweener ([8ad57c8](https://github.com/mob-sakai/UIEffect/commit/8ad57c828ef4f1d7df6dd22c1edb7af3efa04d75)), closes [#321](https://github.com/mob-sakai/UIEffect/issues/321)
* add `TransitionTexSpeed` option ([6b8dc5e](https://github.com/mob-sakai/UIEffect/commit/6b8dc5ec338590d909511eba3bb1b2e0ec6627f3))
* add a tool that automatically fixes shaders when 'TextMeshPro Essential Resources' are located in a non-default path ([8388d59](https://github.com/mob-sakai/UIEffect/commit/8388d590457755cda0699835b37b5bf0673c4386))
* add built-in presets ([3db94e0](https://github.com/mob-sakai/UIEffect/commit/3db94e00f83195ff90d26ee270c7984825fa22b7))
* add shaders for TextMeshPro Overlay/SSD ([51cd6d8](https://github.com/mob-sakai/UIEffect/commit/51cd6d8525a12581c8afd4ab5d16e5968e15c8fe))
* Allow specifying a preset as the target for `UIEffectReplica` ([cb0e8d2](https://github.com/mob-sakai/UIEffect/commit/cb0e8d283bb8f9085d4910051b5ae0b77368db76))
* custom transform for transition and gradation ([045db9c](https://github.com/mob-sakai/UIEffect/commit/045db9c3b79234cd12bdfb4ea52898b7d86240af))
* expose color subfields as float-type public properties ([396d06f](https://github.com/mob-sakai/UIEffect/commit/396d06f774e10adee84d06156a7fc8723d986bbd)), closes [#321](https://github.com/mob-sakai/UIEffect/issues/321)
* load presets partially and append to existing instance ([6542543](https://github.com/mob-sakai/UIEffect/commit/654254342265fc239804e60a64d01b80076e5e8e))
* separate reverse curve for UIEffectTweener ([2540b75](https://github.com/mob-sakai/UIEffect/commit/2540b75349af92f1359433e73ffa3b5400479b02)), closes [#312](https://github.com/mob-sakai/UIEffect/issues/312)
* support `SoftMaskForUGUI ` package with `UIEffect` ([65457e2](https://github.com/mob-sakai/UIEffect/commit/65457e263644c36cd772ad1f42fb9fb3f84ab753)), closes [#270](https://github.com/mob-sakai/UIEffect/issues/270)
* support UIFlip as v4 compatible component ([e965b9e](https://github.com/mob-sakai/UIEffect/commit/e965b9e9ab33dcfab067542abf2f19bc1d5243fc)), closes [#322](https://github.com/mob-sakai/UIEffect/issues/322)
* update demo sample ([abc9a41](https://github.com/mob-sakai/UIEffect/commit/abc9a4184c4aeac85287a882d174f9cdc2c28c04)), closes [#318](https://github.com/mob-sakai/UIEffect/issues/318) [#320](https://github.com/mob-sakai/UIEffect/issues/320)
## [5.5.3](https://github.com/mob-sakai/UIEffect/compare/5.5.2...5.5.3) (2025-03-06)
### Bug Fixes
* blur with 'Filled' Image type may cause error ([f0a7642](https://github.com/mob-sakai/UIEffect/commit/f0a76424e690355c101cc2e12183d1a7e77b16c3)), closes [#313](https://github.com/mob-sakai/UIEffect/issues/313)
* IL2CPP build fails on older versions of Unity ([1af89af](https://github.com/mob-sakai/UIEffect/commit/1af89af2c58320f67b8d753767b3b4cf905f844d)), closes [#315](https://github.com/mob-sakai/UIEffect/issues/315)
## [5.5.2](https://github.com/mob-sakai/UIEffect/compare/5.5.1...5.5.2) (2025-02-28)
### Bug Fixes
* `PlayOnEnable.Reverse` in UIEffectTweener does not work ([3f5a7dc](https://github.com/mob-sakai/UIEffect/commit/3f5a7dcd2d8248b9e47fb9d38c083f26b798e063)), closes [#310](https://github.com/mob-sakai/UIEffect/issues/310)
* `TransitionFilter` and `GradationMode` do not work correctly when the initial scale is 0 ([bdbf293](https://github.com/mob-sakai/UIEffect/commit/bdbf293c1489c0b248078969b37ec66890620d44)), closes [#311](https://github.com/mob-sakai/UIEffect/issues/311)
* component icons will no longer be displayed in the scene view (Unity 2021.2 or later) ([40ff828](https://github.com/mob-sakai/UIEffect/commit/40ff828ff0697dc8f6597cfcf094cc63532a19dd))
* fix potential issues ([a748adf](https://github.com/mob-sakai/UIEffect/commit/a748adf1bde5e400fcc84ec902a1438867105f75))
* reset time button does not work correctly in the inspector when `UIEffectTweener.direction=Reverse` in the editor ([8513970](https://github.com/mob-sakai/UIEffect/commit/8513970e6f71d393430a573bfb0207428998bee1)), closes [#310](https://github.com/mob-sakai/UIEffect/issues/310)
## [5.5.1](https://github.com/mob-sakai/UIEffect/compare/5.5.0...5.5.1) (2025-02-14)
@@ -0,0 +1,35 @@
using System.Collections.Generic;
using UnityEditor.Build;
using UnityEditor.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
using PackageInfo = UnityEditor.PackageManager.PackageInfo;
namespace Coffee.UIEffects.Editors
{
internal class RemoveSoftMaskableVariantsIfNeeded : IPreprocessShaders
{
public int callbackOrder => 1;
// Remove the 'SOFTMASKABLE' variants if 'SoftMaskForUGUI' package is not installed.
public void OnProcessShader(Shader shader, ShaderSnippetData snippet, IList<ShaderCompilerData> data)
{
// If the shader is not for UIEffect: skip.
if (!shader.name.EndsWith(" (UIEffect)")) return;
// If the 'SoftMaskForUGUI' package is installed: skip.
if (PackageInfo.FindForAssetPath("Packages/com.coffee.softmask-for-ugui/package.json") != null) return;
// Remove the 'SOFTMASKABLE' variants.
var softMaskable = new ShaderKeyword(shader, "SOFTMASKABLE");
for (var i = data.Count - 1; i >= 0; i--)
{
var d = data[i];
if (d.shaderKeywordSet.IsEnabled(softMaskable))
{
data.RemoveAt(i);
}
}
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e42595bbbad4941a686a82e328aa266b
timeCreated: 1487152293
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+85 -517
View File
@@ -2,7 +2,6 @@
using UnityEngine;
using System.Linq;
using System;
using System.Reflection;
using Object = UnityEngine.Object;
namespace Coffee.UIEffects.Editors
@@ -12,558 +11,93 @@ namespace Coffee.UIEffects.Editors
/// </summary>
[CustomEditor(typeof(UIEffect), true)]
[CanEditMultipleObjects]
public class UIEffect2Editor : Editor
public class UIEffectEditor : UIEffectPropertyEditor
{
private static readonly PropertyInfo s_PiGradient = typeof(SerializedProperty)
.GetProperty("gradientValue", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
private static readonly Func<SerializedProperty, Gradient> s_GetGradient =
(Func<SerializedProperty, Gradient>)Delegate.CreateDelegate(typeof(Func<SerializedProperty, Gradient>),
s_PiGradient.GetMethod);
private static readonly Action<SerializedProperty, Gradient> s_SetGradient =
(Action<SerializedProperty, Gradient>)Delegate.CreateDelegate(typeof(Action<SerializedProperty, Gradient>),
s_PiGradient.SetMethod);
private SerializedProperty _toneFilter;
private SerializedProperty _toneIntensity;
private SerializedProperty _colorFilter;
private SerializedProperty _color;
private SerializedProperty _colorIntensity;
private SerializedProperty _colorGlow;
private SerializedProperty _samplingFilter;
private SerializedProperty _samplingIntensity;
private SerializedProperty _samplingWidth;
private SerializedProperty _samplingScale;
private SerializedProperty _transitionFilter;
private SerializedProperty _transitionRate;
private SerializedProperty _transitionTex;
private SerializedProperty _transitionTexScale;
private SerializedProperty _transitionTexOffset;
private SerializedProperty _transitionReverse;
private SerializedProperty _transitionRotation;
private SerializedProperty _transitionKeepAspectRatio;
private SerializedProperty _transitionWidth;
private SerializedProperty _transitionSoftness;
private SerializedProperty _transitionRange;
private SerializedProperty _transitionColorFilter;
private SerializedProperty _transitionColor;
private SerializedProperty _transitionColorGlow;
private SerializedProperty _transitionPatternReverse;
private SerializedProperty _transitionAutoPlaySpeed;
private SerializedProperty _targetMode;
private SerializedProperty _targetColor;
private SerializedProperty _targetRange;
private SerializedProperty _targetSoftness;
private SerializedProperty _blendType;
private SerializedProperty _srcBlendMode;
private SerializedProperty _dstBlendMode;
private SerializedProperty _shadowMode;
private SerializedProperty _shadowDistance;
private SerializedProperty _shadowDistanceX;
private SerializedProperty _shadowDistanceY;
private SerializedProperty _shadowIteration;
private SerializedProperty _shadowFade;
private SerializedProperty _shadowMirrorScale;
private SerializedProperty _shadowBlurIntensity;
private SerializedProperty _shadowColorFilter;
private SerializedProperty _shadowColor;
private SerializedProperty _shadowColorGlow;
private SerializedProperty _gradationMode;
private SerializedProperty _gradationColor1;
private SerializedProperty _gradationColor2;
private SerializedProperty _gradationColor3;
private SerializedProperty _gradationColor4;
private SerializedProperty _gradationGradient;
private SerializedProperty _gradationOffset;
private SerializedProperty _gradationScale;
private SerializedProperty _gradationRotation;
private SerializedProperty _edgeMode;
private SerializedProperty _edgeWidth;
private SerializedProperty _edgeColorFilter;
private SerializedProperty _edgeColor;
private SerializedProperty _edgeShinyRate;
private SerializedProperty _edgeShinyWidth;
private SerializedProperty _edgeShinyAutoPlaySpeed;
private SerializedProperty _patternArea;
private bool _expandOthers = true;
private SerializedProperty _allowToModifyMeshShape;
private void OnEnable()
private class UIEffectEditorSettings : ScriptableSingleton<UIEffectEditorSettings>
{
if (target == null) return;
public bool m_ExpandOthers = true;
}
_toneFilter = serializedObject.FindProperty("m_ToneFilter");
_toneIntensity = serializedObject.FindProperty("m_ToneIntensity");
private SerializedProperty _samplingScale;
private SerializedProperty _allowToModifyMeshShape;
private SerializedProperty _customRoot;
_colorFilter = serializedObject.FindProperty("m_ColorFilter");
_color = serializedObject.FindProperty("m_Color");
_colorIntensity = serializedObject.FindProperty("m_ColorIntensity");
_colorGlow = serializedObject.FindProperty("m_ColorGlow");
private static bool expandOthers
{
set => UIEffectEditorSettings.instance.m_ExpandOthers = value;
get => UIEffectEditorSettings.instance.m_ExpandOthers;
}
protected override void OnEnable()
{
base.OnEnable();
_samplingFilter = serializedObject.FindProperty("m_SamplingFilter");
_samplingIntensity = serializedObject.FindProperty("m_SamplingIntensity");
_samplingWidth = serializedObject.FindProperty("m_SamplingWidth");
_samplingScale = serializedObject.FindProperty("m_SamplingScale");
_transitionFilter = serializedObject.FindProperty("m_TransitionFilter");
_transitionRate = serializedObject.FindProperty("m_TransitionRate");
_transitionTex = serializedObject.FindProperty("m_TransitionTex");
_transitionTexScale = serializedObject.FindProperty("m_TransitionTexScale");
_transitionTexOffset = serializedObject.FindProperty("m_TransitionTexOffset");
_transitionReverse = serializedObject.FindProperty("m_TransitionReverse");
_transitionRotation = serializedObject.FindProperty("m_TransitionRotation");
_transitionKeepAspectRatio = serializedObject.FindProperty("m_TransitionKeepAspectRatio");
_transitionWidth = serializedObject.FindProperty("m_TransitionWidth");
_transitionSoftness = serializedObject.FindProperty("m_TransitionSoftness");
_transitionRange = serializedObject.FindProperty("m_TransitionRange");
_transitionColorFilter = serializedObject.FindProperty("m_TransitionColorFilter");
_transitionColor = serializedObject.FindProperty("m_TransitionColor");
_transitionColorGlow = serializedObject.FindProperty("m_TransitionColorGlow");
_transitionPatternReverse = serializedObject.FindProperty("m_TransitionPatternReverse");
_transitionAutoPlaySpeed = serializedObject.FindProperty("m_TransitionAutoPlaySpeed");
_targetMode = serializedObject.FindProperty("m_TargetMode");
_targetColor = serializedObject.FindProperty("m_TargetColor");
_targetRange = serializedObject.FindProperty("m_TargetRange");
_targetSoftness = serializedObject.FindProperty("m_TargetSoftness");
_blendType = serializedObject.FindProperty("m_BlendType");
_srcBlendMode = serializedObject.FindProperty("m_SrcBlendMode");
_dstBlendMode = serializedObject.FindProperty("m_DstBlendMode");
_shadowMode = serializedObject.FindProperty("m_ShadowMode");
_shadowDistance = serializedObject.FindProperty("m_ShadowDistance");
_shadowDistanceX = _shadowDistance.FindPropertyRelative("x");
_shadowDistanceY = _shadowDistance.FindPropertyRelative("y");
_shadowIteration = serializedObject.FindProperty("m_ShadowIteration");
_shadowFade = serializedObject.FindProperty("m_ShadowFade");
_shadowMirrorScale = serializedObject.FindProperty("m_ShadowMirrorScale");
_shadowBlurIntensity = serializedObject.FindProperty("m_ShadowBlurIntensity");
_shadowColorFilter = serializedObject.FindProperty("m_ShadowColorFilter");
_shadowColor = serializedObject.FindProperty("m_ShadowColor");
_shadowColorGlow = serializedObject.FindProperty("m_ShadowColorGlow");
_edgeMode = serializedObject.FindProperty("m_EdgeMode");
_edgeWidth = serializedObject.FindProperty("m_EdgeWidth");
_edgeColorFilter = serializedObject.FindProperty("m_EdgeColorFilter");
_edgeColor = serializedObject.FindProperty("m_EdgeColor");
_edgeShinyRate = serializedObject.FindProperty("m_EdgeShinyRate");
_edgeShinyWidth = serializedObject.FindProperty("m_EdgeShinyWidth");
_edgeShinyAutoPlaySpeed = serializedObject.FindProperty("m_EdgeShinyAutoPlaySpeed");
_patternArea = serializedObject.FindProperty("m_PatternArea");
_gradationMode = serializedObject.FindProperty("m_GradationMode");
_gradationColor1 = serializedObject.FindProperty("m_GradationColor1");
_gradationColor2 = serializedObject.FindProperty("m_GradationColor2");
_gradationColor3 = serializedObject.FindProperty("m_GradationColor3");
_gradationColor4 = serializedObject.FindProperty("m_GradationColor4");
_gradationGradient = serializedObject.FindProperty("m_GradationGradient");
_gradationOffset = serializedObject.FindProperty("m_GradationOffset");
_gradationScale = serializedObject.FindProperty("m_GradationScale");
_gradationRotation = serializedObject.FindProperty("m_GradationRotation");
_allowToModifyMeshShape = serializedObject.FindProperty("m_AllowToModifyMeshShape");
_customRoot = serializedObject.FindProperty("m_CustomRoot");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
// Preset
DrawPresetMenu(targets);
DrawSeparator();
// Properties
DrawProperties();
serializedObject.ApplyModifiedProperties();
}
public void DrawProperties()
{
serializedObject.Update();
// Tone filter
if (DrawHeaderPopup(_toneFilter))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_toneIntensity);
EditorGUI.indentLevel--;
}
// Color filter
// Others
DrawSeparator();
var prevColorFilter = (ColorFilter)_colorFilter.intValue;
if (DrawHeaderPopup(_colorFilter))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_colorIntensity);
DrawColor(_color, (ColorFilter)_colorFilter.intValue, prevColorFilter, false);
EditorGUILayout.PropertyField(_colorGlow);
EditorGUI.indentLevel--;
}
EditorGUI.EndChangeCheck();
// Sampling filter
DrawSeparator();
if (DrawHeaderPopup(_samplingFilter))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_samplingIntensity);
if (_samplingFilter.intValue == (int)SamplingFilter.EdgeAlpha
|| _samplingFilter.intValue == (int)SamplingFilter.EdgeLuminance)
{
EditorGUILayout.PropertyField(_samplingWidth);
}
EditorGUI.indentLevel--;
}
// Transition filter
DrawSeparator();
if (DrawHeaderPopup(_transitionFilter))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_transitionRate);
EditorGUILayout.PropertyField(_transitionTex);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_transitionTexScale, EditorGUIUtility.TrTempContent("Scale"));
EditorGUILayout.PropertyField(_transitionTexOffset, EditorGUIUtility.TrTempContent("Offset"));
EditorGUILayout.PropertyField(_transitionRotation, EditorGUIUtility.TrTempContent("Rotation"));
EditorGUILayout.PropertyField(_transitionKeepAspectRatio,
EditorGUIUtility.TrTempContent("Keep Aspect Ratio"));
EditorGUILayout.PropertyField(_transitionReverse, EditorGUIUtility.TrTempContent("Reverse"));
EditorGUI.indentLevel--;
if (_transitionFilter.intValue == (int)TransitionFilter.Pattern)
{
EditorGUILayout.PropertyField(_transitionWidth, EditorGUIUtility.TrTempContent("Pattern Size"));
EditorGUILayout.PropertyField(_transitionRange, EditorGUIUtility.TrTempContent("Pattern Range"));
EditorGUILayout.PropertyField(_transitionPatternReverse,
EditorGUIUtility.TrTempContent("Pattern Reverse"));
DrawColor(_transitionColorFilter, _transitionColor, null);
}
else if (2 < _transitionFilter.intValue)
{
EditorGUILayout.PropertyField(_transitionWidth);
EditorGUILayout.PropertyField(_transitionSoftness);
DrawColor(_transitionColorFilter, _transitionColor, _transitionColorGlow);
}
EditorGUILayout.PropertyField(_transitionAutoPlaySpeed);
if (0 < _transitionFilter.intValue && !Mathf.Approximately(0, _transitionAutoPlaySpeed.floatValue))
{
EditorApplication.QueuePlayerLoopUpdate();
}
EditorGUI.indentLevel--;
}
// Target
DrawSeparator();
if (DrawHeaderPopup(_targetMode))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_targetColor);
EditorGUILayout.PropertyField(_targetRange);
EditorGUILayout.PropertyField(_targetSoftness);
EditorGUI.indentLevel--;
}
// Blending
DrawSeparator();
if (!DrawHeaderPopup(_blendType))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_srcBlendMode);
EditorGUILayout.PropertyField(_dstBlendMode);
EditorGUI.indentLevel--;
}
// Shadow
DrawSeparator();
var prevShadowMode = (ShadowMode)_shadowMode.intValue;
if (DrawHeaderPopup(_shadowMode))
{
EditorGUI.indentLevel++;
if ((ShadowMode)_shadowMode.intValue == ShadowMode.Mirror)
{
if (prevShadowMode != ShadowMode.Mirror)
{
_shadowDistanceX.floatValue = 0.5f;
_shadowDistanceY.floatValue = 0f;
}
EditorGUILayout.Slider(_shadowDistanceX, 0, 1, "Reflection");
EditorGUILayout.PropertyField(_shadowDistanceY, EditorGUIUtility.TrTempContent("Offset"));
EditorGUILayout.PropertyField(_shadowMirrorScale);
EditorGUILayout.PropertyField(_shadowFade);
}
else
{
if (prevShadowMode == ShadowMode.Mirror)
{
_shadowDistanceX.floatValue = 1f;
_shadowDistanceY.floatValue = -1f;
}
EditorGUILayout.PropertyField(_shadowDistance);
EditorGUILayout.PropertyField(_shadowIteration);
DrawColor(_shadowColorFilter, _shadowColor, _shadowColorGlow, false);
EditorGUILayout.PropertyField(_shadowFade);
}
// Shadow blur intensity
switch ((SamplingFilter)_samplingFilter.intValue)
{
case SamplingFilter.BlurFast:
case SamplingFilter.BlurMedium:
case SamplingFilter.BlurDetail:
EditorGUILayout.PropertyField(_shadowBlurIntensity);
break;
}
EditorGUI.indentLevel--;
}
// Gradient
DrawSeparator();
if (DrawHeaderPopup(_gradationMode))
{
EditorGUI.indentLevel++;
switch ((GradationMode)_gradationMode.intValue)
{
case GradationMode.HorizontalGradient:
case GradationMode.VerticalGradient:
case GradationMode.AngleGradient:
DrawGradientField(_gradationGradient);
break;
case GradationMode.Diagonal:
DrawColorPickerField("Top", _gradationColor1, _gradationColor2);
DrawColorPickerField("Bottom", _gradationColor3, _gradationColor4);
break;
default:
DrawColorPickerField(EditorGUILayout.GetControlRect(), _gradationColor1, true);
var r = EditorGUILayout.GetControlRect();
r.width -= 24;
DrawColorPickerField(r, _gradationColor2, true);
r.x += r.width + 4;
r.width = 20;
SwapColorsButton(r, _gradationColor1, _gradationColor2);
break;
}
EditorGUILayout.PropertyField(_gradationOffset);
EditorGUILayout.PropertyField(_gradationScale);
if ((GradationMode)_gradationMode.intValue == GradationMode.Angle
|| (GradationMode)_gradationMode.intValue == GradationMode.AngleGradient)
{
EditorGUILayout.PropertyField(_gradationRotation);
}
EditorGUI.indentLevel--;
}
// Edge Mode
DrawSeparator();
if (DrawHeaderPopup(_edgeMode))
{
EditorGUILayout.PropertyField(_edgeWidth);
DrawColor(_edgeColorFilter, _edgeColor, null);
if ((EdgeMode)_edgeMode.intValue == EdgeMode.Shiny)
{
EditorGUILayout.PropertyField(_edgeShinyRate);
EditorGUILayout.PropertyField(_edgeShinyWidth);
EditorGUILayout.PropertyField(_edgeShinyAutoPlaySpeed);
if (!Mathf.Approximately(0, _edgeShinyAutoPlaySpeed.floatValue))
{
EditorApplication.QueuePlayerLoopUpdate();
}
}
if (_transitionFilter.intValue == (int)TransitionFilter.Pattern)
{
EditorGUILayout.PropertyField(_patternArea);
}
}
DrawSeparator();
_expandOthers = EditorGUILayout.BeginFoldoutHeaderGroup(_expandOthers, "Others");
if (_expandOthers)
expandOthers = EditorGUILayout.BeginFoldoutHeaderGroup(expandOthers, "Others");
if (expandOthers)
{
EditorGUILayout.PropertyField(_samplingScale);
EditorGUILayout.PropertyField(_allowToModifyMeshShape);
}
}
private static void DrawColorPickerField(string label, SerializedProperty color1, SerializedProperty color2)
{
var labelWidth = EditorGUIUtility.labelWidth;
var r = EditorGUILayout.GetControlRect();
r.width -= 24;
EditorGUI.PrefixLabel(new Rect(r.x, r.y, labelWidth, r.height), EditorGUIUtility.TrTempContent(label));
var indentLevel = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
var rPos = new Rect(r.x + labelWidth, r.y, (r.width - labelWidth) / 2, r.height);
DrawColorPickerField(rPos, GUIContent.none, color1, true);
rPos.x += rPos.width;
DrawColorPickerField(rPos, GUIContent.none, color2, true);
// Swap colors button
SwapColorsButton(new Rect(r.x + r.width + 4, r.y, 20, 20), color1, color2);
EditorGUI.indentLevel = indentLevel;
}
private static void DrawColorPickerField(Rect rect, SerializedProperty color, bool showAlpha)
{
var label = EditorGUIUtility.TrTempContent(color.displayName);
label.tooltip = color.tooltip;
DrawColorPickerField(rect, label, color, showAlpha);
}
private static void DrawColorPickerField(Rect rect, GUIContent label, SerializedProperty color, bool showAlpha)
{
var hdr = UIEffectProjectSettings.useHdrColorPicker;
EditorGUI.showMixedValue = color.hasMultipleDifferentValues;
EditorGUI.BeginChangeCheck();
var colorValue = EditorGUI.ColorField(rect, label, color.colorValue, true, showAlpha, hdr);
if (EditorGUI.EndChangeCheck())
{
color.colorValue = colorValue;
}
}
private static void DrawGradientField(SerializedProperty gradient)
{
var r = EditorGUILayout.GetControlRect();
var label = EditorGUIUtility.TrTempContent(gradient.displayName);
label.tooltip = gradient.tooltip;
var hdr = UIEffectProjectSettings.useHdrColorPicker;
EditorGUI.showMixedValue = gradient.hasMultipleDifferentValues;
EditorGUI.BeginChangeCheck();
var gradientValue = EditorGUI.GradientField(r, label, s_GetGradient(gradient), hdr);
if (EditorGUI.EndChangeCheck())
{
s_SetGradient(gradient, gradientValue);
}
}
private static void DrawColor(SerializedProperty color, ColorFilter filter, ColorFilter prevFilter,
bool showAlpha = true)
{
if (filter == ColorFilter.None) return;
if (filter == ColorFilter.HsvModifier)
{
if (prevFilter != ColorFilter.HsvModifier)
{
color.colorValue = Color.black;
}
EditorGUILayout.Slider(color.FindPropertyRelative("r"), -0.5f, 0.5f, "Hue");
EditorGUILayout.Slider(color.FindPropertyRelative("g"), -1f, 1f, "Saturation");
EditorGUILayout.Slider(color.FindPropertyRelative("b"), -1f, 1f, "Value");
EditorGUILayout.Slider(color.FindPropertyRelative("a"), 0, 1, "Alpha");
}
else if (filter == ColorFilter.Contrast)
{
if (prevFilter != ColorFilter.Contrast)
{
color.colorValue = Color.black;
}
EditorGUILayout.Slider(color.FindPropertyRelative("r"), -1f, 1f, "Contrast");
EditorGUILayout.Slider(color.FindPropertyRelative("g"), -1f, 1f, "Brightness");
EditorGUILayout.Slider(color.FindPropertyRelative("a"), 0, 1, "Alpha");
}
else
{
if (prevFilter == ColorFilter.HsvModifier || prevFilter == ColorFilter.Contrast)
{
color.colorValue = Color.white;
}
DrawColorPickerField(EditorGUILayout.GetControlRect(), color, showAlpha);
}
}
private static void DrawColor(SerializedProperty filter, SerializedProperty color, SerializedProperty glow,
bool showAlpha = true)
{
var prevFilter = (ColorFilter)filter.intValue;
EditorGUILayout.PropertyField(filter);
if (filter.intValue == (int)ColorFilter.None) return;
EditorGUI.indentLevel++;
DrawColor(color, (ColorFilter)filter.intValue, prevFilter, showAlpha);
if (glow != null)
{
EditorGUILayout.PropertyField(glow);
EditorGUILayout.PropertyField(_customRoot);
}
EditorGUI.indentLevel--;
}
EditorGUILayout.EndFoldoutHeaderGroup();
private static void SwapColorsButton(Rect rect, SerializedProperty color1, SerializedProperty color2)
{
if (GUI.Button(rect, EditorGUIUtility.IconContent("preaudioloopoff"), "iconbutton"))
{
(color1.colorValue, color2.colorValue) = (color2.colorValue, color1.colorValue);
}
}
private static bool DrawHeaderPopup(SerializedProperty sp)
{
var r = EditorGUILayout.GetControlRect();
var pos = EditorGUI.PrefixLabel(r, EditorGUIUtility.TrTempContent(sp.displayName), EditorStyles.boldLabel);
EditorGUI.PropertyField(pos, sp, GUIContent.none);
return 0 < sp.intValue;
}
private static void DrawSeparator()
{
EditorGUILayout.Space(4);
GUILayout.Label(GUIContent.none, "sv_iconselector_sep", GUILayout.ExpandWidth(true));
serializedObject.ApplyModifiedProperties();
}
private static void DrawPresetMenu(Object[] targets)
{
var r = EditorGUILayout.GetControlRect();
r.width /= 2;
r.width = (r.width - 185) / 2;
if (GUI.Button(r, EditorGUIUtility.TrTempContent("Load"), "MiniPopup"))
{
var menu = new GenericMenu();
foreach (var preset in UIEffectProjectSettings.LoadEditorPresets())
DropDownPreset(r, null, p =>
{
var path = UIEffectProjectSettings.GetPresetPath(preset);
menu.AddItem(new GUIContent(path), false, () =>
Undo.RecordObjects(targets, "Load UIEffect Preset");
Array.ForEach(targets.OfType<UIEffect>().ToArray(), t =>
{
Array.ForEach(targets.OfType<UIEffect>().ToArray(), t =>
{
t.LoadPreset(preset);
});
t.LoadPreset(p, false);
});
}
menu.DropDown(r);
});
}
r.x += r.width;
if (GUI.Button(r, EditorGUIUtility.TrTempContent("Append"), "MiniPopup"))
{
DropDownPreset(r, null, p =>
{
Undo.RecordObjects(targets, "Append UIEffect Preset");
Array.ForEach(targets.OfType<UIEffect>().ToArray(), t =>
{
t.LoadPreset(p, true);
});
});
}
r.x += r.width;
r.width = 15;
GUI.Label(r, GUIContent.none, "BreadcrumbsSeparator");
r.x += r.width;
r.width = 100;
if (GUI.Button(r, EditorGUIUtility.TrTempContent("Save As New"), "MiniButton"))
{
EditorApplication.delayCall += () =>
@@ -571,6 +105,40 @@ namespace Coffee.UIEffects.Editors
UIEffectProjectSettings.SaveAsNewPreset(targets.OfType<UIEffect>().FirstOrDefault());
};
}
r.x += r.width;
r.width = 15;
GUI.Label(r, GUIContent.none, "BreadcrumbsSeparator");
r.x += r.width;
r.width = 55;
if (GUI.Button(r, EditorGUIUtility.TrTempContent("Clear"), "MiniButton"))
{
Undo.RecordObjects(targets, "Clear UIEffect");
Array.ForEach(targets.OfType<UIEffect>().ToArray(), Unsupported.SmartReset);
}
}
public static void DropDownPreset(Rect r, Predicate<(string path, bool builtin, UIEffectPreset preset)> valid,
Action<UIEffectPreset> callback)
{
var menu = new GenericMenu();
var separatorAdded = false;
foreach (var preset in UIEffectProjectSettings.LoadEditorPresetsV2())
{
var (path, builtin) = UIEffectProjectSettings.GetPresetPath(preset);
if (valid != null && valid.Invoke((path, builtin, preset)) == false) continue;
if (builtin && !separatorAdded)
{
separatorAdded = true;
menu.AddSeparator(string.Empty);
}
menu.AddItem(new GUIContent(path.Replace("-", "/")), false, x => callback(x as UIEffectPreset), preset);
}
menu.DropDown(r);
}
}
}
@@ -0,0 +1,13 @@
using UnityEditor;
namespace Coffee.UIEffects.Editors
{
/// <summary>
/// UIEffect editor.
/// </summary>
[CustomEditor(typeof(UIEffectPreset), true)]
[CanEditMultipleObjects]
public class UIEffectPresetEditor : UIEffectPropertyEditor
{
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3aef1549bb83f4e6babaf8bc9648ee1b
guid: 60b661e9d7501483dbd6b02ffa399405
MonoImporter:
externalObjects: {}
serializedVersion: 2
@@ -1,4 +1,8 @@
using UnityEditor;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
using Coffee.UIEffectInternal;
using UnityEditorInternal;
@@ -9,24 +13,29 @@ namespace Coffee.UIEffects.Editors
public class UIEffectProjectSettingsEditor : Editor
{
private ReorderableList _reorderableList;
private SerializedProperty _runtimePresets;
private SerializedProperty _runtimePresetsV2;
private SerializedProperty _useHDRColorPicker;
private SerializedProperty _transformSensitivity;
private bool _isInitialized;
private ShaderVariantRegistryEditor _shaderVariantRegistryEditor;
private UIEffect[] _legacyPresets;
private bool _expandRuntimePresets;
private bool _expandLegacyPrefabs;
private void InitializeIfNeeded()
{
if (_isInitialized) return;
_transformSensitivity = serializedObject.FindProperty("m_TransformSensitivity");
_useHDRColorPicker = serializedObject.FindProperty("m_UseHDRColorPicker");
var runtimePresets = serializedObject.FindProperty("m_RuntimePresets");
_reorderableList = new ReorderableList(serializedObject, runtimePresets, true, true, true, true);
_runtimePresets = serializedObject.FindProperty("m_RuntimePresets");
_runtimePresetsV2 = serializedObject.FindProperty("m_RuntimePresetsV2");
_reorderableList = new ReorderableList(serializedObject, _runtimePresetsV2, true, true, true, true);
_reorderableList.drawHeaderCallback = rect => EditorGUI.LabelField(rect, "Runtime Presets");
_reorderableList.drawElementCallback = (rect, index, isActive, isFocused) =>
{
var element = _reorderableList.serializedProperty.GetArrayElementAtIndex(index);
var effect = element.objectReferenceValue as UIEffect;
var effect = element.objectReferenceValue as UIEffectPreset;
rect.y += 2;
rect.height = EditorGUIUtility.singleLineHeight;
@@ -36,24 +45,19 @@ namespace Coffee.UIEffects.Editors
};
_reorderableList.onAddDropdownCallback = (rect, list) =>
{
var menu = new GenericMenu();
foreach (var preset in UIEffectProjectSettings.LoadEditorPresets())
{
if (UIEffectProjectSettings.instance.m_RuntimePresets.Contains(preset)) continue;
var path = UIEffectProjectSettings.GetPresetPath(preset);
menu.AddItem(new GUIContent(path), false, x =>
{
UIEffectProjectSettings.RegisterRuntimePreset(x as UIEffect);
}, preset);
}
menu.DropDown(rect);
UIEffectEditor.DropDownPreset(rect,
x => !UIEffectProjectSettings.instance.m_RuntimePresetsV2.Contains(x.preset),
UIEffectProjectSettings.RegisterRuntimePreset);
};
_isInitialized = true;
}
private void OnEnable()
{
_legacyPresets = UIEffectProjectSettings.LoadEditorPresets();
}
private void OnDisable()
{
_isInitialized = false;
@@ -65,12 +69,12 @@ namespace Coffee.UIEffects.Editors
InitializeIfNeeded();
// Settings
// Transform sensitivity.
EditorGUILayout.PropertyField(_transformSensitivity);
// Runtime Presets
_reorderableList.DoLayoutList();
// Legacy Presets
DrawLegacyPresets();
// Editor
// Use HDR color pickers.
EditorGUILayout.PropertyField(_useHDRColorPicker);
@@ -82,12 +86,130 @@ namespace Coffee.UIEffects.Editors
if (_shaderVariantRegistryEditor == null)
{
var property = serializedObject.FindProperty("m_ShaderVariantRegistry");
_shaderVariantRegistryEditor = new ShaderVariantRegistryEditor(property, "(UIEffect)");
_shaderVariantRegistryEditor = new ShaderVariantRegistryEditor(property, "(UIEffect)",
() =>
{
UIEffectProjectSettings.shaderRegistry
.RegisterOptionalShaders(UIEffectProjectSettings.instance);
});
}
_shaderVariantRegistryEditor.Draw();
GUILayout.FlexibleSpace();
serializedObject.ApplyModifiedProperties();
}
private void DrawLegacyPresets()
{
for (var i = _runtimePresets.arraySize - 1; 0 <= i; i--)
{
if (!_runtimePresets.GetArrayElementAtIndex(i).objectReferenceValue)
{
_runtimePresets.DeleteArrayElementAtIndex(i);
}
}
if (_legacyPresets.Length == 0 && _runtimePresets.arraySize == 0) return;
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
var title = EditorGUIUtility.TrTextContent("Legacy Presets (Obsolete)", "", "warning");
EditorGUILayout.LabelField(title,
EditorStyles.boldLabel);
_expandRuntimePresets = EditorGUILayout.Foldout(_expandRuntimePresets,
$"Legacy Runtime Presets ({_runtimePresets.arraySize})");
if (_expandRuntimePresets)
{
EditorGUI.BeginDisabledGroup(true);
EditorGUI.indentLevel++;
for (var i = 0; i < _runtimePresets.arraySize; i++)
{
EditorGUILayout.PropertyField(_runtimePresets.GetArrayElementAtIndex(i), GUIContent.none);
}
EditorGUI.indentLevel--;
EditorGUI.EndDisabledGroup();
}
_expandLegacyPrefabs = EditorGUILayout.Foldout(_expandLegacyPrefabs,
$"Legacy Preset Prefabs ({_legacyPresets.Length})");
if (_expandLegacyPrefabs)
{
EditorGUI.BeginDisabledGroup(true);
EditorGUI.indentLevel++;
foreach (var legacyPreset in _legacyPresets)
{
EditorGUILayout.ObjectField(legacyPreset, typeof(UIEffect), false);
}
EditorGUI.indentLevel--;
EditorGUI.EndDisabledGroup();
}
EditorGUILayout.TextArea(
"The prefab based presets system is obsolete.\n" +
"In the new preset system, UIEffectPreset assets are used.\n" +
"Click the button below to convert your legacy preset prefabs into UIEffectPreset assets.\n" +
"The UIEffectPreset asset will be saved in the same directory as the prefab, using the same name.\n" +
"You can load the new preset via the UIEffect.LoadPreset method.",
EditorStyles.miniLabel);
if (GUILayout.Button(EditorGUIUtility.TrTempContent("Convert All Legacy Presets in the Project")))
{
ConvertAllLegacyPresets();
_runtimePresets.ClearArray();
}
if (GUILayout.Button(EditorGUIUtility.TrTempContent("Delete All Legacy Presets in the Project")))
{
foreach (var legacyPreset in _legacyPresets)
{
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(legacyPreset));
}
_runtimePresets.ClearArray();
_legacyPresets = Array.Empty<UIEffect>();
}
EditorGUILayout.EndVertical();
}
private void ConvertAllLegacyPresets()
{
var length = _legacyPresets.Length;
var converted = new HashSet<string>(UIEffectProjectSettings.LoadEditorPresetsV2()
.Select(x => Path.ChangeExtension(AssetDatabase.GetAssetPath(x), ".prefab")));
for (var i = 0; i < length; i++)
{
var preset = _legacyPresets[i];
var path = AssetDatabase.GetAssetPath(preset);
if (converted.Contains(path)) continue;
EditorUtility.DisplayProgressBar("Convert To UIEffectPreset", path, (float)i / length);
var newPath = Path.ChangeExtension(path, ".asset");
newPath = AssetDatabase.GenerateUniqueAssetPath(newPath);
var newPreset = CreateInstance<UIEffectPreset>();
preset.SavePreset(newPreset, false);
newPreset.hideFlags = preset.hideFlags;
AssetDatabase.CreateAsset(newPreset, newPath);
var importer = AssetImporter.GetAtPath(path);
var newImporter = AssetImporter.GetAtPath(newPath);
newImporter.userData = importer.userData;
newImporter.SetAssetBundleNameAndVariant(importer.assetBundleName, importer.assetBundleVariant);
newImporter.SaveAndReimport();
// Remove the legacy preset from the project settings and add the new preset.
if (UIEffectProjectSettings.instance.m_RuntimePresets.Contains(preset))
{
var count = _runtimePresetsV2.arraySize;
_runtimePresetsV2.InsertArrayElementAtIndex(count);
_runtimePresetsV2.GetArrayElementAtIndex(count).objectReferenceValue = newPreset;
}
}
EditorUtility.ClearProgressBar();
}
}
}
@@ -0,0 +1,594 @@
using UnityEditor;
using UnityEngine;
using System;
using System.Reflection;
namespace Coffee.UIEffects.Editors
{
public abstract class UIEffectPropertyEditor : Editor
{
private static readonly PropertyInfo s_PiGradient = typeof(SerializedProperty)
.GetProperty("gradientValue", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
private static readonly Func<SerializedProperty, Gradient> s_GetGradient =
(Func<SerializedProperty, Gradient>)Delegate.CreateDelegate(typeof(Func<SerializedProperty, Gradient>),
s_PiGradient.GetMethod);
private static readonly Action<SerializedProperty, Gradient> s_SetGradient =
(Action<SerializedProperty, Gradient>)Delegate.CreateDelegate(typeof(Action<SerializedProperty, Gradient>),
s_PiGradient.SetMethod);
private SerializedProperty _toneFilter;
private SerializedProperty _toneIntensity;
private SerializedProperty _colorFilter;
private SerializedProperty _color;
private SerializedProperty _colorIntensity;
private SerializedProperty _colorGlow;
private SerializedProperty _samplingFilter;
private SerializedProperty _samplingIntensity;
private SerializedProperty _samplingWidth;
private SerializedProperty _transitionFilter;
private SerializedProperty _transitionRate;
private SerializedProperty _transitionTex;
private SerializedProperty _transitionTexScale;
private SerializedProperty _transitionTexOffset;
private SerializedProperty _transitionTexSpeed;
private SerializedProperty _transitionReverse;
private SerializedProperty _transitionRotation;
private SerializedProperty _transitionKeepAspectRatio;
private SerializedProperty _transitionWidth;
private SerializedProperty _transitionSoftness;
private SerializedProperty _transitionRange;
private SerializedProperty _transitionColorFilter;
private SerializedProperty _transitionColor;
private SerializedProperty _transitionColorGlow;
private SerializedProperty _transitionPatternReverse;
private SerializedProperty _transitionAutoPlaySpeed;
private SerializedProperty _targetMode;
private SerializedProperty _targetColor;
private SerializedProperty _targetRange;
private SerializedProperty _targetSoftness;
private SerializedProperty _blendType;
private SerializedProperty _srcBlendMode;
private SerializedProperty _dstBlendMode;
private SerializedProperty _shadowMode;
private SerializedProperty _shadowDistance;
private SerializedProperty _shadowDistanceX;
private SerializedProperty _shadowDistanceY;
private SerializedProperty _shadowIteration;
private SerializedProperty _shadowFade;
private SerializedProperty _shadowMirrorScale;
private SerializedProperty _shadowBlurIntensity;
private SerializedProperty _shadowColorFilter;
private SerializedProperty _shadowColor;
private SerializedProperty _shadowColorGlow;
private SerializedProperty _gradationMode;
private SerializedProperty _gradationIntensity;
private SerializedProperty _gradationColorFilter;
private SerializedProperty _gradationColor1;
private SerializedProperty _gradationColor2;
private SerializedProperty _gradationColor3;
private SerializedProperty _gradationColor4;
private SerializedProperty _gradationGradient;
private SerializedProperty _gradationOffset;
private SerializedProperty _gradationScale;
private SerializedProperty _gradationRotation;
private SerializedProperty _edgeMode;
private SerializedProperty _edgeWidth;
private SerializedProperty _edgeColorFilter;
private SerializedProperty _edgeColor;
private SerializedProperty _edgeColorGlow;
private SerializedProperty _edgeShinyRate;
private SerializedProperty _edgeShinyWidth;
private SerializedProperty _edgeShinyAutoPlaySpeed;
private SerializedProperty _patternArea;
private SerializedProperty _detailFilter;
private SerializedProperty _detailIntensity;
private SerializedProperty _detailColor;
private SerializedProperty _detailThreshold;
private SerializedProperty _detailTex;
private SerializedProperty _detailTexScale;
private SerializedProperty _detailTexOffset;
private SerializedProperty _detailTexSpeed;
private SerializedProperty _flip;
private static GUIContent s_RotationLabel = new GUIContent("* Rotation");
private static GUIContent s_KeepAspectRatioLabel = new GUIContent("* Keep Aspect Ratio");
protected virtual void OnEnable()
{
_toneFilter = serializedObject.FindProperty("m_ToneFilter");
_toneIntensity = serializedObject.FindProperty("m_ToneIntensity");
_colorFilter = serializedObject.FindProperty("m_ColorFilter");
_color = serializedObject.FindProperty("m_Color");
_colorIntensity = serializedObject.FindProperty("m_ColorIntensity");
_colorGlow = serializedObject.FindProperty("m_ColorGlow");
_samplingFilter = serializedObject.FindProperty("m_SamplingFilter");
_samplingIntensity = serializedObject.FindProperty("m_SamplingIntensity");
_samplingWidth = serializedObject.FindProperty("m_SamplingWidth");
_transitionFilter = serializedObject.FindProperty("m_TransitionFilter");
_transitionRate = serializedObject.FindProperty("m_TransitionRate");
_transitionTex = serializedObject.FindProperty("m_TransitionTex");
_transitionTexScale = serializedObject.FindProperty("m_TransitionTexScale");
_transitionTexOffset = serializedObject.FindProperty("m_TransitionTexOffset");
_transitionTexSpeed = serializedObject.FindProperty("m_TransitionTexSpeed");
_transitionReverse = serializedObject.FindProperty("m_TransitionReverse");
_transitionRotation = serializedObject.FindProperty("m_TransitionRotation");
_transitionKeepAspectRatio = serializedObject.FindProperty("m_TransitionKeepAspectRatio");
_transitionWidth = serializedObject.FindProperty("m_TransitionWidth");
_transitionSoftness = serializedObject.FindProperty("m_TransitionSoftness");
_transitionRange = serializedObject.FindProperty("m_TransitionRange");
_transitionColorFilter = serializedObject.FindProperty("m_TransitionColorFilter");
_transitionColor = serializedObject.FindProperty("m_TransitionColor");
_transitionColorGlow = serializedObject.FindProperty("m_TransitionColorGlow");
_transitionPatternReverse = serializedObject.FindProperty("m_TransitionPatternReverse");
_transitionAutoPlaySpeed = serializedObject.FindProperty("m_TransitionAutoPlaySpeed");
s_RotationLabel.tooltip = _transitionRotation.tooltip;
s_KeepAspectRatioLabel.tooltip = _transitionKeepAspectRatio.tooltip;
_targetMode = serializedObject.FindProperty("m_TargetMode");
_targetColor = serializedObject.FindProperty("m_TargetColor");
_targetRange = serializedObject.FindProperty("m_TargetRange");
_targetSoftness = serializedObject.FindProperty("m_TargetSoftness");
_blendType = serializedObject.FindProperty("m_BlendType");
_srcBlendMode = serializedObject.FindProperty("m_SrcBlendMode");
_dstBlendMode = serializedObject.FindProperty("m_DstBlendMode");
_shadowMode = serializedObject.FindProperty("m_ShadowMode");
_shadowDistance = serializedObject.FindProperty("m_ShadowDistance");
_shadowDistanceX = _shadowDistance.FindPropertyRelative("x");
_shadowDistanceY = _shadowDistance.FindPropertyRelative("y");
_shadowIteration = serializedObject.FindProperty("m_ShadowIteration");
_shadowFade = serializedObject.FindProperty("m_ShadowFade");
_shadowMirrorScale = serializedObject.FindProperty("m_ShadowMirrorScale");
_shadowBlurIntensity = serializedObject.FindProperty("m_ShadowBlurIntensity");
_shadowColorFilter = serializedObject.FindProperty("m_ShadowColorFilter");
_shadowColor = serializedObject.FindProperty("m_ShadowColor");
_shadowColorGlow = serializedObject.FindProperty("m_ShadowColorGlow");
_edgeMode = serializedObject.FindProperty("m_EdgeMode");
_edgeWidth = serializedObject.FindProperty("m_EdgeWidth");
_edgeColorFilter = serializedObject.FindProperty("m_EdgeColorFilter");
_edgeColor = serializedObject.FindProperty("m_EdgeColor");
_edgeColorGlow = serializedObject.FindProperty("m_EdgeColorGlow");
_edgeShinyRate = serializedObject.FindProperty("m_EdgeShinyRate");
_edgeShinyWidth = serializedObject.FindProperty("m_EdgeShinyWidth");
_edgeShinyAutoPlaySpeed = serializedObject.FindProperty("m_EdgeShinyAutoPlaySpeed");
_patternArea = serializedObject.FindProperty("m_PatternArea");
_gradationMode = serializedObject.FindProperty("m_GradationMode");
_gradationIntensity = serializedObject.FindProperty("m_GradationIntensity");
_gradationColorFilter = serializedObject.FindProperty("m_GradationColorFilter");
_gradationColor1 = serializedObject.FindProperty("m_GradationColor1");
_gradationColor2 = serializedObject.FindProperty("m_GradationColor2");
_gradationColor3 = serializedObject.FindProperty("m_GradationColor3");
_gradationColor4 = serializedObject.FindProperty("m_GradationColor4");
_gradationGradient = serializedObject.FindProperty("m_GradationGradient");
_gradationOffset = serializedObject.FindProperty("m_GradationOffset");
_gradationScale = serializedObject.FindProperty("m_GradationScale");
_gradationRotation = serializedObject.FindProperty("m_GradationRotation");
_detailFilter = serializedObject.FindProperty("m_DetailFilter");
_detailIntensity = serializedObject.FindProperty("m_DetailIntensity");
_detailColor = serializedObject.FindProperty("m_DetailColor");
_detailThreshold = serializedObject.FindProperty("m_DetailThreshold");
_detailTex = serializedObject.FindProperty("m_DetailTex");
_detailTexScale = serializedObject.FindProperty("m_DetailTexScale");
_detailTexOffset = serializedObject.FindProperty("m_DetailTexOffset");
_detailTexSpeed = serializedObject.FindProperty("m_DetailTexSpeed");
_flip = serializedObject.FindProperty("m_Flip");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
DrawProperties();
serializedObject.ApplyModifiedProperties();
}
public void DrawProperties()
{
// Tone filter
if (DrawHeaderPopup(_toneFilter))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_toneIntensity);
EditorGUI.indentLevel--;
}
// Color filter
DrawSeparator();
var prevColorFilter = (ColorFilter)_colorFilter.intValue;
if (DrawHeaderPopup(_colorFilter))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_colorIntensity);
DrawColor(_color, (ColorFilter)_colorFilter.intValue, prevColorFilter, false);
EditorGUILayout.PropertyField(_colorGlow);
EditorGUI.indentLevel--;
}
EditorGUI.EndChangeCheck();
// Sampling filter
DrawSeparator();
if (DrawHeaderPopup(_samplingFilter))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_samplingIntensity);
if (_samplingFilter.intValue == (int)SamplingFilter.EdgeAlpha
|| _samplingFilter.intValue == (int)SamplingFilter.EdgeLuminance)
{
EditorGUILayout.PropertyField(_samplingWidth);
}
EditorGUI.indentLevel--;
}
// Transition filter
DrawSeparator();
if (DrawHeaderPopup(_transitionFilter))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_transitionRate);
EditorGUILayout.PropertyField(_transitionTex);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_transitionTexScale, EditorGUIUtility.TrTempContent("Scale"));
EditorGUILayout.PropertyField(_transitionTexOffset, EditorGUIUtility.TrTempContent("Offset"));
EditorGUILayout.PropertyField(_transitionTexSpeed, EditorGUIUtility.TrTempContent("Speed"));
if (_transitionTexSpeed.vector2Value != Vector2.zero)
{
EditorApplication.QueuePlayerLoopUpdate();
}
EditorGUILayout.PropertyField(_transitionRotation, s_RotationLabel);
EditorGUILayout.PropertyField(_transitionKeepAspectRatio, s_KeepAspectRatioLabel);
EditorGUILayout.PropertyField(_transitionReverse, EditorGUIUtility.TrTempContent("Reverse"));
EditorGUI.indentLevel--;
if (_transitionFilter.intValue == (int)TransitionFilter.Pattern)
{
EditorGUILayout.PropertyField(_transitionWidth, EditorGUIUtility.TrTempContent("Pattern Size"));
EditorGUILayout.PropertyField(_transitionRange, EditorGUIUtility.TrTempContent("Pattern Range"));
EditorGUILayout.PropertyField(_transitionPatternReverse,
EditorGUIUtility.TrTempContent("Pattern Reverse"));
DrawColor(_transitionColorFilter, _transitionColor, null);
}
else if (2 < _transitionFilter.intValue)
{
EditorGUILayout.PropertyField(_transitionWidth);
EditorGUILayout.PropertyField(_transitionSoftness);
DrawColor(_transitionColorFilter, _transitionColor, _transitionColorGlow);
}
EditorGUILayout.PropertyField(_transitionAutoPlaySpeed);
if (0 < _transitionFilter.intValue && !Mathf.Approximately(0, _transitionAutoPlaySpeed.floatValue))
{
EditorApplication.QueuePlayerLoopUpdate();
}
EditorGUI.indentLevel--;
}
// Target
DrawSeparator();
if (DrawHeaderPopup(_targetMode))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_targetColor);
EditorGUILayout.PropertyField(_targetRange);
EditorGUILayout.PropertyField(_targetSoftness);
EditorGUI.indentLevel--;
}
// Blending
DrawSeparator();
if (!DrawHeaderPopup(_blendType))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_srcBlendMode);
EditorGUILayout.PropertyField(_dstBlendMode);
EditorGUI.indentLevel--;
}
// Shadow
DrawSeparator();
var prevShadowMode = (ShadowMode)_shadowMode.intValue;
if (DrawHeaderPopup(_shadowMode))
{
EditorGUI.indentLevel++;
if ((ShadowMode)_shadowMode.intValue == ShadowMode.Mirror)
{
if (prevShadowMode != ShadowMode.Mirror)
{
_shadowDistanceX.floatValue = 0.5f;
_shadowDistanceY.floatValue = 0f;
}
EditorGUILayout.Slider(_shadowDistanceX, 0, 1, "Reflection");
EditorGUILayout.PropertyField(_shadowDistanceY, EditorGUIUtility.TrTempContent("Offset"));
EditorGUILayout.PropertyField(_shadowMirrorScale);
EditorGUILayout.PropertyField(_shadowFade);
}
else
{
if (prevShadowMode == ShadowMode.Mirror)
{
_shadowDistanceX.floatValue = 1f;
_shadowDistanceY.floatValue = -1f;
}
EditorGUILayout.PropertyField(_shadowDistance);
EditorGUILayout.PropertyField(_shadowIteration);
DrawColor(_shadowColorFilter, _shadowColor, _shadowColorGlow, false);
EditorGUILayout.PropertyField(_shadowFade);
}
// Shadow blur intensity
switch ((SamplingFilter)_samplingFilter.intValue)
{
case SamplingFilter.BlurFast:
case SamplingFilter.BlurMedium:
case SamplingFilter.BlurDetail:
EditorGUILayout.PropertyField(_shadowBlurIntensity);
break;
}
EditorGUI.indentLevel--;
}
// Gradient
DrawSeparator();
if (DrawHeaderPopup(_gradationMode))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_gradationColorFilter);
switch ((GradationMode)_gradationMode.intValue)
{
case GradationMode.HorizontalGradient:
case GradationMode.VerticalGradient:
case GradationMode.AngleGradient:
DrawGradientField(_gradationGradient);
break;
case GradationMode.Diagonal:
DrawColorPickerField("Top", _gradationColor1, _gradationColor2);
DrawColorPickerField("Bottom", _gradationColor3, _gradationColor4);
break;
default:
DrawColorPickerField(EditorGUILayout.GetControlRect(), _gradationColor1, true);
var r = EditorGUILayout.GetControlRect();
r.width -= 24;
DrawColorPickerField(r, _gradationColor2, true);
r.x += r.width + 4;
r.width = 20;
SwapColorsButton(r, _gradationColor1, _gradationColor2);
break;
}
EditorGUILayout.PropertyField(_gradationIntensity);
EditorGUILayout.PropertyField(_gradationOffset);
EditorGUILayout.PropertyField(_gradationScale);
if ((GradationMode)_gradationMode.intValue == GradationMode.Angle
|| (GradationMode)_gradationMode.intValue == GradationMode.AngleGradient)
{
EditorGUILayout.PropertyField(_gradationRotation);
}
EditorGUILayout.PropertyField(_transitionKeepAspectRatio, s_KeepAspectRatioLabel);
EditorGUI.indentLevel--;
}
// Edge Mode
DrawSeparator();
if (DrawHeaderPopup(_edgeMode))
{
EditorGUILayout.PropertyField(_edgeWidth);
DrawColor(_edgeColorFilter, _edgeColor, _edgeColorGlow);
if ((EdgeMode)_edgeMode.intValue == EdgeMode.Shiny)
{
EditorGUILayout.PropertyField(_edgeShinyRate);
EditorGUILayout.PropertyField(_edgeShinyWidth);
EditorGUILayout.PropertyField(_edgeShinyAutoPlaySpeed);
if (!Mathf.Approximately(0, _edgeShinyAutoPlaySpeed.floatValue))
{
EditorApplication.QueuePlayerLoopUpdate();
}
}
if (_transitionFilter.intValue == (int)TransitionFilter.Pattern)
{
EditorGUILayout.PropertyField(_patternArea);
}
}
// Detail filter
DrawSeparator();
if (DrawHeaderPopup(_detailFilter))
{
EditorGUI.indentLevel++;
if ((DetailFilter)_detailFilter.intValue == DetailFilter.Masking)
{
EditorGUILayout.PropertyField(_detailThreshold);
}
else
{
EditorGUILayout.PropertyField(_detailIntensity);
DrawColorPickerField(EditorGUILayout.GetControlRect(), _detailColor, true);
}
EditorGUILayout.PropertyField(_detailTex);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_detailTexScale, EditorGUIUtility.TrTempContent("Scale"));
EditorGUILayout.PropertyField(_detailTexOffset, EditorGUIUtility.TrTempContent("Offset"));
EditorGUILayout.PropertyField(_detailTexSpeed, EditorGUIUtility.TrTempContent("Speed"));
if (_detailTexSpeed.vector2Value != Vector2.zero)
{
EditorApplication.QueuePlayerLoopUpdate();
}
EditorGUILayout.PropertyField(_transitionRotation, s_RotationLabel);
EditorGUILayout.PropertyField(_transitionKeepAspectRatio, s_KeepAspectRatioLabel);
EditorGUI.indentLevel--;
EditorGUI.indentLevel--;
}
// Flip
DrawSeparator();
DrawHeaderPopup(_flip);
}
private static void DrawColorPickerField(string label, SerializedProperty color1, SerializedProperty color2)
{
var labelWidth = EditorGUIUtility.labelWidth;
var r = EditorGUILayout.GetControlRect();
r.width -= 24;
EditorGUI.PrefixLabel(new Rect(r.x, r.y, labelWidth, r.height), EditorGUIUtility.TrTempContent(label));
var indentLevel = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
var rPos = new Rect(r.x + labelWidth, r.y, (r.width - labelWidth) / 2, r.height);
DrawColorPickerField(rPos, GUIContent.none, color1, true);
rPos.x += rPos.width;
DrawColorPickerField(rPos, GUIContent.none, color2, true);
// Swap colors button
SwapColorsButton(new Rect(r.x + r.width + 4, r.y, 20, 20), color1, color2);
EditorGUI.indentLevel = indentLevel;
}
private static void DrawColorPickerField(Rect rect, SerializedProperty color, bool showAlpha)
{
var label = EditorGUIUtility.TrTempContent(color.displayName);
label.tooltip = color.tooltip;
DrawColorPickerField(rect, label, color, showAlpha);
}
private static void DrawColorPickerField(Rect rect, GUIContent label, SerializedProperty color, bool showAlpha)
{
var hdr = UIEffectProjectSettings.useHdrColorPicker;
EditorGUI.showMixedValue = color.hasMultipleDifferentValues;
EditorGUI.BeginChangeCheck();
var colorValue = EditorGUI.ColorField(rect, label, color.colorValue, true, showAlpha, hdr);
if (EditorGUI.EndChangeCheck())
{
color.colorValue = colorValue;
}
}
private static void DrawGradientField(SerializedProperty gradient)
{
var r = EditorGUILayout.GetControlRect();
var label = EditorGUIUtility.TrTempContent(gradient.displayName);
label.tooltip = gradient.tooltip;
var hdr = UIEffectProjectSettings.useHdrColorPicker;
EditorGUI.showMixedValue = gradient.hasMultipleDifferentValues;
EditorGUI.BeginChangeCheck();
var gradientValue = EditorGUI.GradientField(r, label, s_GetGradient(gradient), hdr);
if (EditorGUI.EndChangeCheck())
{
s_SetGradient(gradient, gradientValue);
}
}
private static void DrawColor(SerializedProperty color, ColorFilter filter, ColorFilter prevFilter,
bool showAlpha = true)
{
if (filter == ColorFilter.None) return;
if (filter == ColorFilter.HsvModifier)
{
if (prevFilter != ColorFilter.HsvModifier)
{
color.colorValue = Color.black;
}
EditorGUILayout.Slider(color.FindPropertyRelative("r"), -0.5f, 0.5f, "Hue");
EditorGUILayout.Slider(color.FindPropertyRelative("g"), -1f, 1f, "Saturation");
EditorGUILayout.Slider(color.FindPropertyRelative("b"), -1f, 1f, "Value");
EditorGUILayout.Slider(color.FindPropertyRelative("a"), 0, 1, "Alpha");
}
else if (filter == ColorFilter.Contrast)
{
if (prevFilter != ColorFilter.Contrast)
{
color.colorValue = Color.black;
}
EditorGUILayout.Slider(color.FindPropertyRelative("r"), -1f, 1f, "Contrast");
EditorGUILayout.Slider(color.FindPropertyRelative("g"), -1f, 1f, "Brightness");
EditorGUILayout.Slider(color.FindPropertyRelative("a"), 0, 1, "Alpha");
}
else
{
if (prevFilter == ColorFilter.HsvModifier || prevFilter == ColorFilter.Contrast)
{
color.colorValue = Color.white;
}
DrawColorPickerField(EditorGUILayout.GetControlRect(), color, showAlpha);
}
}
private static void DrawColor(SerializedProperty filter, SerializedProperty color, SerializedProperty glow,
bool showAlpha = true)
{
var prevFilter = (ColorFilter)filter.intValue;
EditorGUILayout.PropertyField(filter);
if (filter.intValue == (int)ColorFilter.None) return;
EditorGUI.indentLevel++;
DrawColor(color, (ColorFilter)filter.intValue, prevFilter, showAlpha);
if (glow != null)
{
EditorGUILayout.PropertyField(glow);
}
EditorGUI.indentLevel--;
}
private static void SwapColorsButton(Rect rect, SerializedProperty color1, SerializedProperty color2)
{
if (GUI.Button(rect, EditorGUIUtility.IconContent("preaudioloopoff"), "iconbutton"))
{
(color1.colorValue, color2.colorValue) = (color2.colorValue, color1.colorValue);
}
}
private static bool DrawHeaderPopup(SerializedProperty sp)
{
var r = EditorGUILayout.GetControlRect();
var pos = EditorGUI.PrefixLabel(r, EditorGUIUtility.TrTempContent(sp.displayName), EditorStyles.boldLabel);
EditorGUI.PropertyField(pos, sp, GUIContent.none);
return 0 < sp.intValue;
}
protected static void DrawSeparator()
{
EditorGUILayout.Space(4);
GUILayout.Label(GUIContent.none, "sv_iconselector_sep", GUILayout.ExpandWidth(true));
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2b54493685c0d4cf49bbc33b1492bed5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+54 -4
View File
@@ -1,4 +1,5 @@
using UnityEditor;
using UnityEngine;
namespace Coffee.UIEffects.Editors
{
@@ -10,33 +11,82 @@ namespace Coffee.UIEffects.Editors
public class UIEffectReplicaEditor : Editor
{
private SerializedProperty _target;
private SerializedProperty _preset;
private SerializedProperty _useTargetTransform;
private SerializedProperty _samplingScale;
private SerializedProperty _allowToModifyMeshShape;
private SerializedProperty _customRoot;
private Editor _uiEffectEditor;
private void OnEnable()
{
_target = serializedObject.FindProperty("m_Target");
_preset = serializedObject.FindProperty("m_Preset");
_useTargetTransform = serializedObject.FindProperty("m_UseTargetTransform");
_samplingScale = serializedObject.FindProperty("m_SamplingScale");
_allowToModifyMeshShape = serializedObject.FindProperty("m_AllowToModifyMeshShape");
_customRoot = serializedObject.FindProperty("m_CustomRoot");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(_target);
var r = EditorGUILayout.GetControlRect();
r.width -= 120;
if (_preset.objectReferenceValue)
{
EditorGUI.PropertyField(r, _preset);
}
else
{
EditorGUI.PropertyField(r, _target);
}
// Preset button.
r.x += r.width;
r.width = 60;
if (GUI.Button(r, EditorGUIUtility.TrTempContent("Preset"), "MiniPopup"))
{
UIEffectEditor.DropDownPreset(r, null, p =>
{
_target.objectReferenceValue = null;
_preset.objectReferenceValue = p;
_preset.serializedObject.ApplyModifiedProperties();
});
}
// Clear button.
r.x += r.width;
r.width = 60;
if (GUI.Button(r, EditorGUIUtility.TrTempContent("Clear")))
{
_target.objectReferenceValue = null;
_preset.objectReferenceValue = null;
}
// Preset mode warning.
if (_target.objectReferenceValue is UIEffect targetEffect && !targetEffect.gameObject.scene.IsValid())
{
r = EditorGUILayout.GetControlRect();
EditorGUI.HelpBox(r, "The target effect is not in the scene. (Preset mode)", MessageType.Warning);
}
EditorGUILayout.PropertyField(_useTargetTransform);
EditorGUI.BeginDisabledGroup(_useTargetTransform.boolValue);
EditorGUILayout.PropertyField(_customRoot);
EditorGUI.EndDisabledGroup();
EditorGUILayout.PropertyField(_samplingScale);
EditorGUILayout.PropertyField(_allowToModifyMeshShape);
if (_target.objectReferenceValue)
var parent = _target.objectReferenceValue ?? _preset.objectReferenceValue;
if (parent)
{
EditorGUI.BeginDisabledGroup(true);
CreateCachedEditor(_target.objectReferenceValue, null, ref _uiEffectEditor);
CreateCachedEditor(parent, null, ref _uiEffectEditor);
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
(_uiEffectEditor as UIEffect2Editor)?.DrawProperties();
(_uiEffectEditor as UIEffectPropertyEditor)?.DrawProperties();
EditorGUILayout.EndVertical();
EditorGUI.EndDisabledGroup();
}
+32 -1
View File
@@ -12,6 +12,8 @@ namespace Coffee.UIEffects.Editors
private SerializedProperty _cullingMask;
private SerializedProperty _direction;
private SerializedProperty _curve;
private SerializedProperty _separateReverseCurve;
private SerializedProperty _reverseCurve;
private SerializedProperty _delay;
private SerializedProperty _duration;
private SerializedProperty _interval;
@@ -20,6 +22,7 @@ namespace Coffee.UIEffects.Editors
private SerializedProperty _updateMode;
private SerializedProperty _wrapMode;
private SerializedProperty _onComplete;
private SerializedProperty _onChangedRate;
private bool _isPlaying = false;
private double _lastTime;
@@ -28,6 +31,8 @@ namespace Coffee.UIEffects.Editors
_cullingMask = serializedObject.FindProperty("m_CullingMask");
_direction = serializedObject.FindProperty("m_Direction");
_curve = serializedObject.FindProperty("m_Curve");
_separateReverseCurve = serializedObject.FindProperty("m_SeparateReverseCurve");
_reverseCurve = serializedObject.FindProperty("m_ReverseCurve");
_playOnEnable = serializedObject.FindProperty("m_PlayOnEnable");
_resetTimeOnEnable = serializedObject.FindProperty("m_ResetTimeOnEnable");
_delay = serializedObject.FindProperty("m_Delay");
@@ -36,6 +41,7 @@ namespace Coffee.UIEffects.Editors
_wrapMode = serializedObject.FindProperty("m_WrapMode");
_updateMode = serializedObject.FindProperty("m_UpdateMode");
_onComplete = serializedObject.FindProperty("m_OnComplete");
_onChangedRate = serializedObject.FindProperty("m_OnChangedRate");
EditorApplication.update += UpdateTweeners;
}
@@ -50,8 +56,25 @@ namespace Coffee.UIEffects.Editors
Profiler.BeginSample("(UIE)[UIEffectTweener] OnInspectorGUI");
serializedObject.UpdateIfRequiredOrScript();
EditorGUILayout.PropertyField(_cullingMask);
if (0 != (_cullingMask.intValue & (int)UIEffectTweener.CullingMask.Event))
{
EditorGUILayout.PropertyField(_onChangedRate);
}
EditorGUILayout.PropertyField(_direction);
EditorGUILayout.PropertyField(_curve);
var pos = EditorGUILayout.GetControlRect();
var rect = new Rect(pos.x, pos.y, EditorGUIUtility.labelWidth + 20, pos.height);
EditorGUI.PropertyField(rect, _separateReverseCurve);
if (_separateReverseCurve.boolValue)
{
rect.x += rect.width;
rect.width = pos.width - rect.width;
EditorGUI.PropertyField(rect, _reverseCurve, GUIContent.none);
}
EditorGUILayout.PropertyField(_delay);
EditorGUILayout.PropertyField(_duration);
EditorGUILayout.PropertyField(_interval);
@@ -77,7 +100,7 @@ namespace Coffee.UIEffects.Editors
var rResetTimeButton = new Rect(r.x, r.y, 20, r.height);
if (GUI.Button(rResetTimeButton, EditorGUIUtility.IconContent("animation.firstkey"), "IconButton"))
{
SetTime(0);
ResetTime();
}
var rPlayButton = new Rect(r.x + 20, r.y, 20, r.height);
@@ -149,6 +172,14 @@ namespace Coffee.UIEffects.Editors
}
}
private void ResetTime()
{
foreach (var tweener in targets.OfType<UIEffectTweener>())
{
tweener.ResetTime(tweener.direction);
}
}
private void SetPlaying(bool enable)
{
if (!EditorApplication.isPlaying)
+248 -66
View File
@@ -1,11 +1,12 @@
# <img alt="logo" height="26" src="https://github.com/user-attachments/assets/dc72baf5-eadf-463e-abc9-464477fd0b9e"/> UIEffect v5 <!-- omit in toc -->
# <img alt="logo" height="26" src="https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-logo.png"/> UIEffect v5 <!-- omit in toc -->
[![](https://img.shields.io/npm/v/com.coffee.ui-effect?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.coffee.ui-effect/)
[![](https://img.shields.io/github/v/release/mob-sakai/UIEffect?include_prereleases)](https://github.com/mob-sakai/UIEffect/releases)
[![](https://img.shields.io/github/release-date/mob-sakai/UIEffect.svg)](https://github.com/mob-sakai/UIEffect/releases)
![](https://img.shields.io/badge/Unity-2020.3+-57b9d3.svg?style=flat&logo=unity)
![](https://img.shields.io/badge/Unity-6000.0+-57b9d3.svg?style=flat&logo=unity)
![](https://img.shields.io/badge/Unity-6000.0+-57b9d3.svg?style=flat&logo=unity)
![](https://img.shields.io/badge/TextMeshPro_Support-57b9d3.svg?style=flat)
![](https://img.shields.io/badge/ShaderGraph_Support-57b9d3.svg?style=flat)
![](https://img.shields.io/badge/UPR%2FHDPR_Support-57b9d3.svg?style=flat)
![](https://img.shields.io/badge/VR_Support-57b9d3.svg?style=flat)
[![](https://img.shields.io/github/license/mob-sakai/UIEffect.svg)](https://github.com/mob-sakai/UIEffect/blob/main/LICENSE.md)
@@ -23,7 +24,7 @@
UIEffect is an open-source package that allows you to intuitively apply rich Unity UI effects directly from the Inspector or via code.
Combine various filters, such as grayscale, blur, and dissolve, to decorate your UI with a unique visual style!
![](https://github.com/user-attachments/assets/bce4ddb2-766f-4bed-bad2-fda91bb8133c)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-demo-title.png)
- [📌 Key Features](#-key-features)
- [🎮 Demo](#-demo)
@@ -37,12 +38,29 @@ Combine various filters, such as grayscale, blur, and dissolve, to decorate your
- [🚀 Usage](#-usage)
- [Getting Started](#getting-started)
- [Component: UIEffect](#component-uieffect)
- [Tone Filter](#tone-filter)
- [Color Filter](#color-filter)
- [Sampling Filter](#sampling-filter)
- [Transition Filter](#transition-filter)
- [Target Mode](#target-mode)
- [Blend Type](#blend-type)
- [Shadow Mode](#shadow-mode)
- [Gradation Mode](#gradation-mode)
- [Edge Mode](#edge-mode)
- [Detail Filter](#detail-filter)
- [Flip](#flip)
- [Others](#others)
- [Component: UIEffectTweener](#component-uieffecttweener)
- [Component: UIEffectReplica](#component-uieffectreplica)
- [Usage with TextMeshPro](#usage-with-textmeshpro)
- [Usage with SoftMaskForUGUI](#usage-with-softmaskforugui)
- [Usage with ShaderGraph](#usage-with-shadergraph)
- [Runtime/Editor Preset for UIEffect](#runtimeeditor-preset-for-uieffect)
- [Usage with Code](#usage-with-code)
- [Project Settings](#project-settings)
- [Settings](#settings)
- [Editor](#editor)
- [Shader](#shader)
- [:warning: Limitations](#warning-limitations)
- [🤝 Contributing](#-contributing)
- [Issues](#issues)
@@ -56,7 +74,7 @@ Combine various filters, such as grayscale, blur, and dissolve, to decorate your
## 📌 Key Features
![](https://github.com/user-attachments/assets/e5112713-166d-451f-8090-501e6ea156ca)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-keyfeatures.png)
- **UIEffect is out-of-the-box!**: Easily apply effects by adjusting parameters directly in the inspector.
- **Rich effect combinations**: Decorate your UI with a variety of effects, such as grayscale, blur, and dissolve, by combining multiple filters and parameters.
@@ -68,14 +86,18 @@ Combine various filters, such as grayscale, blur, and dissolve, to decorate your
- **UIEffectTweener Component**: A simple tweener component to play, stop, pause, and resume effects.
- **AnimationClip support**: Allows control of effect animations using `AnimationClips`.
- **v4 compatible components (optional)**: For easy upgrading with minimal changes, compatible v4 components are available optionally.
- **SoftMaskForUGUI support (optional)**: Compatible with SoftMaskForUGUI for creating soft masks for UI elements. See for more details [here](#usage-with-softmaskforugui).
- **ShaderGraph support (optional)**: Add `Canvas (UIEffect)` sub target (material) for UIEffect shaders. See for more details [here](#usage-with-shadergraph).
<br><br>
## 🎮 Demo
![](https://github.com/user-attachments/assets/37a46a7e-1f15-4a52-a928-09a2ed857a47)
![](https://github.com/user-attachments/assets/f1fa2485-e635-4923-a53f-6825d7f85873)
![](https://github.com/user-attachments/assets/1ed410bf-b782-433b-9429-721278c5ba1e)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-demo-available.png)
<img src="https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-demo-pattern.gif" width="582"/>
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-demo-showcase.png)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-demo-tmp.png)
[WebGL Demo](https://mob-sakai.github.io/UIEffect/)
@@ -95,16 +117,16 @@ _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.3.0
openupm add com.coffee.ui-effect@5.7.0
```
### Install via UPM (with Package Manager UI)
- Click `Window > Package Manager` to open Package Manager UI.
- Click `+ > Add package from git URL...` and input the repository URL: `https://github.com/mob-sakai/UIEffect.git?path=Packages/src`
![](https://github.com/user-attachments/assets/f88f47ad-c606-44bd-9e86-ee3f72eac548)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/upm-add-from-url.png)
- To update the package, change suffix `#{version}` to the target version.
- e.g. `https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.3.0`
- e.g. `https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.7.0`
### Install via UPM (Manually)
@@ -119,14 +141,14 @@ _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.3.0",`
- e.g. `"com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.7.0",`
### Install as Embedded Package
1. Download the `Source code (zip)` file from [Releases](https://github.com/mob-sakai/UIEffect/releases) and
extract it.
2. Move the `<extracted_dir>/Packages/src` directory into your project's `Packages` directory.
![](https://github.com/user-attachments/assets/187cbcbe-5922-4ed5-acec-cf19aa17d208)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/upm-add-as-embedded.png)
- You can rename the `src` directory if needed.
- If you intend to fix bugs or add features, installing it as an embedded package is recommended.
- To update the package, re-download it and replace the existing contents.
@@ -137,6 +159,7 @@ Additional resources can be imported to extend functionality.
- [🔄 Upgrading from v4 to v5](#-upgrading-from-v4-to-v5)
- [Usage with TextMeshPro](#usage-with-textmeshpro)
- [Usage with ShaderGraph](#usage-with-shadergraph)
<br><br>
@@ -152,17 +175,17 @@ If upgrading from UIEffect v4 to v5, note the following breaking changes:
// v5
"com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src",
"com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src#main",
```
2. Import the `v4 Compatible Components` sample from the Package Manager window.
![](https://github.com/user-attachments/assets/a1b246d3-3a0b-4a70-a9d2-3e75429fa757)
3. All v4 components are obsolete.
- v4 `UIEffect` component is now `UIEffectV4` component. Change the reference in the code.
- The `effectArea` property in some components are not supported in v5.
- `UIShadow`, `UIGradient`, `UIFlip` components are not supported in v5.
- `UIShadow`, `UIGradient` components are not supported in v5.
- v4 components can be converted to v5 `UIEffect` component by selecting `Convert To UIEffect` from the context menu.
![](https://github.com/user-attachments/assets/4911f06d-4749-4aa8-a72e-deb0fa06bc5d)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-v4-convert.png)
<br><br>
@@ -173,121 +196,226 @@ If upgrading from UIEffect v4 to v5, note the following breaking changes:
1. [Install the package](#-installation).
2. Add a `UIEffect` component to a UI element (Image, RawImage, Text, TextMeshProUGUI, etc...) from the `Add Component` in the inspector or `Component > UI > UIEffect` menu.
![](https://github.com/user-attachments/assets/9e9de844-b265-489e-b8bd-51760996cfd2)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-add-component.png)
3. Adjust the effect filters and parameters in the inspector.
![](https://github.com/user-attachments/assets/38c2df5a-d7f7-4062-a595-8d3e887855cf)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744308178360.gif)
4. Enjoy!
4. From the top menu, you can load/append preset.
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744800851739.gif)
5. Enjoy!
<br><br>
### Component: UIEffect
![](https://github.com/user-attachments/assets/a1642385-ebdc-4a66-b167-10c8b15277e1)
The `UIEffect` component applies visual effects to UI elements, allowing various effects to be achieved by combining multiple filters.
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-preset.png)
> [!TIP]
> From the top menu, you can load and save the editor presets or clear settings.
> For details, refer to the [Runtime/Editor Preset for UIEffect](#runtimeeditor-preset-for-uieffect).
<br>
#### Tone Filter
- **Tone Filter**: `None`, `Grayscale`, `Sepia`, `Nega`, `Retro`, `Posterize`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-tone.png)
- **Tone Filter**: `None`, `Grayscale`, `Sepia`, `Nega`, `Retro`, `Posterize`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-tone.png)
- **Tone Intensity**: 0.0 (no effect) - 1.0 (full effect).
<br>
#### Color Filter
- **Color Filter**: `None`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `Multiply Luminance`, `Multiply Additive`, `Hsv Modifier`, `Contrast`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-color.png)
- **Color Filter**: `None`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `Multiply Luminance`, `Multiply Additive`, `Hsv Modifier`, `Contrast`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-color.png)
- **Color Intensity**: 0.0 (no effect) - 1.0 (full effect).
- **Color Glow**: Set the color to glow.
<br>
#### Sampling Filter
- **Sampling Filter**: `None`, `Blur Fast`, `Blur Medium`, `Blur Detail`, `Pixelation`, `Rgb Shift`, `Edge Luminescence`, `Edge Alpha`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-sampling.png)
- **Sampling Filter**: `None`, `Blur Fast`, `Blur Medium`, `Blur Detail`, `Pixelation`, `Rgb Shift`, `Edge Luminescence`, `Edge Alpha`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-sampling.png)
- **Sampling Intensity**: 0.0 (no effect) - 1.0 (full effect).
- **Sampling Width**: The width of the sampling effect.
<br>
#### Transition Filter
- **Transition Filter**: `None`, `Fade`, `Cutoff`, `Dissolve`, `Shiny`, `Mask`, `Melt`, `Burn`, `Pattern`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-transition.png)
- **Transition Filter**: `None`, `Fade`, `Cutoff`, `Dissolve`, `Shiny`, `Mask`, `Melt`, `Burn`, `Pattern`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-transition.png)
- **Transition Rate**: 0.0 (no effect) - 1.0 (full effect).
- **Transition Tex**: The texture used for the transition filter.- **Transition Width**: The width where the transition color is applied.
- **Transition Tex**: The texture used for the transition filter.
- **Scale**, **Offset**, **Speed**, **Rotation**, **Keep Aspect Ratio**, **Reverse**: Additional properties for the texture.
- ⚠️ NOTE: `Rotation` is shared with `Transition Filter` and `Detail Filter`.
- ⚠️ NOTE: `Keep Aspect Ratio` is shared with `Transition Filter` and `Gradation Mode` and `Detail Filter`.
- **Transition Width**: The width where the transition color is applied.
- **Transition Pattern Range**: The range of the pattern.
- **Transition Pattern Reverse**: Reverse the pattern.
- **Transition Softness**: The softness of the boundary for the transition color.
- **Transition Color Filter**: Specifies the transition color.
- **Transition Color Filter**: `None`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `Multiply Luminance`, `Multiply Additive`, `Hsv Modifier`, `Contrast`
- **Transition Color**: The color of the transition.
- **Transition Color Glow**: Set the transition color to glow.
- **Transition Auto Play Speed**: The speed of the transition animation. You can use this property to loop the `TransitionRate` without tweener or animation.
- **Transition Auto Play Speed**: The speed of the transition animation (using shader side `_Time`). You can use this property to loop the `TransitionRate` without tweener or animation.
> [!TIP]
> **Transition Tex** applies transitions using its alpha channel.
> If you use `Scale`, `Offset`, or `Speed`, set `Wrap Mode = Repeat` in the texture import settings.
> For details, refer to the textures included in the built-in presets.
> ![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/17443051097852.png)
<br>
#### Target Mode
- **Target Mode**: `None`, `Hue`, `Luminance`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-target.png)
- **Target Mode**: `None`, `Hue`, `Luminance`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-target.png)
- Restricts the effect application area based on hue or luminance.
- **Target Range**: The range of target hue or luminance.
- **Target Softness**: The softness of the target boundary.
<br>
#### Blend Type
- **Blend Type**: `Alpha Blend`, `Multiply`, `Additive`, `Soft Additive`, `Multiply Additive`, `Custom`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-blend.png)
- **Blend Type**: `Alpha Blend`, `Multiply`, `Additive`, `Soft Additive`, `Multiply Additive`, `Custom`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-blend.png)
- `Custom` blend type can be set using the `SrcBlend` and `DstBlend` properties.
<br>
#### Shadow Mode
- **Shadow Mode**: `None`, `Shadow`, `Shadow3`, `Outline`, `Outline8`, `Mirror`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-shadow.png)
- **Shadow Mode**: `None`, `Shadow`, `Shadow3`, `Outline`, `Outline8`, `Mirror`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-shadow.png)
- **Shadow Distance**: Distance of the shadow or outline.
- **Shadow Iteration**: Number of times the shadow or outline is applied.
- **Shadow Color Filter**: Specifies the shadow color.
- **Shadow Color Filter**: `None`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `Multiply Luminance`, `Multiply Additive`, `Hsv Modifier`, `Contrast`
- **Shadow Color**: The color of the shadow.
- **Shadow Color Glow**: Set the shadow color to glow.
- **Shadow Fade**: Alpha value of the shadow or outline.
- **Shadow Blur Intensity**: Intensity of the shadow or outline blur.
- **Mirror Reflection**: Distance of the mirrored image.
- **Mirror Offset**: Offset for the mirrored image.
- **Mirror Scale**: Scale of the mirrored image.
- **Shadow Blur Intensity** (`SamplingFilter = Blur***` required): Intensity of the shadow or outline blur.
- **Mirror Reflection** (`Mirror` only): Distance of the mirrored image.
- **Mirror Offset** (`Mirror` only): Offset for the mirrored image.
- **Mirror Scale** (`Mirror` only): Scale of the mirrored image.
<br>
#### Gradation Mode
- **Gradation Mode**: `None`, `Plain`, `Shiny`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744305109784.png)
- **Gradation Mode**: `None`, `Horizontal`, `HorizontalGradient`, `Vertical`, `VerticalGradient`, `Radial`, `Diagonal`, `DiagonalToRightBottom`, `DiagonalToLeftBottom`, `Angle`, `AngleGradient`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-gradation.png)
- **Gradation Color Filter**: `None`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `Multiply Luminance`, `Multiply Additive`
- **Gradation Gradient**: The gradient of the gradation.
- `Blend` and `Fixed` modes are available.
- **Gradation Color 1**: The first color of the gradation.
- **Gradation Color 2**: The second color of the gradation.
- **Gradation Intensity**: 0.0 (no effect) - 1.0 (full effect).
- **Gradation Offset**: The offset of the gradation range.
- **Gradation Scale**: The scale of the gradation range.
- **Gradation Rotation**: The rotation of the gradation range.
- **Gradation Rotation** (`Angle` or `AngleGradient` only): The rotation of the gradation range.
- **Keep Aspect Ratio**:
- ⚠️ NOTE: `Keep Aspect Ratio` is shared with `Transition Filter` and `Gradation Mode` and `Detail Filter`.
> [!TIP]
> `Horizontal Gradient` and `Vertical Gradient` divide the mesh horizontally or vertically and apply a gradient.
> This is very fast but only supports Full Rect.
> `Angle Gradient` divides the mesh at the specified angle and applies a gradient.
> It can be applied to meshes other than Full Rect because it applies the gradient according to the original mesh shape.
> `Gradation Gradient` has two modes, `Blend` and `Fixed`.
<br>
#### Edge Mode
- **Edge Mode**: `None`, `Plain`, `Shiny`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-edge.png)
- **Edge Mode**: `None`, `Plain`, `Shiny`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-edge.png)
- **Edge Width**: The width of the edge.
- **Edge Color Filter**: Specifies the edge color.
- **Edge Color Filter**: `None`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `Multiply Luminance`, `Multiply Additive`, `Hsv Modifier`, `Contrast`
- **Edge Color**: The color of the edge.
- **Edge Color Glow**: Set the shadow color to glow.
- **Edge Shiny Width**: The width of the edge shiny.
- **Edge Shiny Auto Play Speed**: The speed of the edge shiny.
- **Edge Shiny Auto Play Speed**: The speed of the edge shiny (using shader side `_Time`).
<br>
#### Detail Filter
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744762332942.png)
- **Detail Filter**: `None`, `Masking`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `MuliplyAdditive`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744826180386.png)
- **Detail Intensity**: 0.0 (no effect) - 1.0 (full effect).
- **Detail Color**: The color of the detail.
- **Detail Threshold** (`Masking` only): The minimum and maximum alpha values used for masking. The larger the gap
between these values, the stronger the softness effect.
- **Detail Tex**: The texture used for the transition filter.
- **Scale**, **Offset**, **Speed**, **Rotation**, **Keep Aspect Ratio**: Additional properties for the texture.
- ⚠️ NOTE: `Rotation` is shared with `Transition Filter` and `Detail Filter`.
- ⚠️ NOTE: `Keep Aspect Ratio` is shared with `Transition Filter` and `Gradation Mode` and `Detail Filter`.
<br>
#### Flip
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744762521061.png)
- **Flip**: Combine the following flags.
- `Nothing`
- `Horizontal`
- `Vertical`
- `Effect`: Flip with the effect.
- `Shadow`: Flip with the shadow.
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-flip.png)
<br>
#### Others
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744762623263.png)
- **Sampling Scale**: The referencing scale during sampling.
- Larger values are suitable for high-resolution textures.
- **Allow To Modify Mesh Shape**: If enabled, the mesh shape can be modified.
- **Custom Root**: Use the custom transform for some effects.
> [!TIP]
> `Transition Filter`, `Gradation Filter`, and `Detail Filter` usually refer to their own `RectTransform` when applying effects.
> For example, if the mesh shape exceeds the `RectTransform` boundaries, the effect may not be applied correctly.
> By specifying `Custom Root`, you can refer to the specified transform.
> ![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-custom-root.gif)
<br><br>
### Component: UIEffectTweener
![](https://github.com/user-attachments/assets/1c731104-4baf-43f8-ba16-611ee9870df2)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744304918490.png)
The `UIEffectTweener` component animates the effect, enabling easy control over effect animations without the need for an `AnimationClip`.
- **Culling Mask**: `Tone`, `Color`, `Sampling`, `Transition`
- **Culling Mask**: `Tone`, `Color`, `Sampling`, `Transition`, `GradiationOffset`, `GradiationRotation`, `EdgeShiny`, `Event`
- **OnChangeRate** (`Event` only): A event that is triggered when the tweening rate changes.
- **Direction**: `Forward (0.0 -> 1.0)`, `Reverse (1.0 -> 0.0)`
- **Curve**: The curve of the animation.
- **Separate Reverse Curve**: If enabled, `Reverse Curve` will be used for the reverse direction.
- **Reverse Curve**: The curve of the reverse animation.
- **Delay**: The delay time before starting the animation.
- **Duration**: The duration of the animation.
- **Interval**: The interval time between the animation.
@@ -295,7 +423,11 @@ The `UIEffectTweener` component animates the effect, enabling easy control over
- Play the animation automatically when the component is enabled.
- If `None` is selected, the animation will not play automatically. You can play it using the `Play`, `PlayForward` or `PlayReverse` method.
- **Reset Time On Enable**: Reset the tweening time when the component is enabled.
- **Wrap Mode**: `Once`, `Loop`, `PingPongOnce`, `PingPongLoop`
- **Wrap Mode**:
- `Once`: delay -> duration(0-1) -> onComplete
- `Loop`: delay -> duration(0-1) -> interval -> ...
- `PingPongOnce`: delay -> duration(0-1) -> interval -> duration(1-0) -> onComplete
- `PingPongLoop`: delay -> duration(0-1) -> interval -> duration(1-0) -> interval -> ...
- **Update Mode**: `Normal`, `UnscaledTime`, `Manual`
- **On Complete**: A event that is triggered when the animation is completed.
@@ -305,15 +437,18 @@ You can preview the animation using the seek bar and play button.
### Component: UIEffectReplica
![](https://github.com/user-attachments/assets/27558d2e-ee12-4b10-bf13-103474b6c6cc)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744308511445.png)
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.
- **Use Target Transform**: Use the target's transform for some effects.
> [!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.
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-custom-root.gif)
- **Custom Root**: Use the custom transform for some effects.
- **Sampling Scale**: Override the sampling scale.
- **Allow To Modify Mesh Shape**: If enabled, the mesh shape can be modified.
![](https://github.com/user-attachments/assets/127e30fb-15c7-4002-ab65-e8f29e640330)
- **Allow To Modify Mesh Shape**: If enabled, the mesh shape can be modified.
<br><br>
@@ -323,35 +458,72 @@ 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.
![](https://github.com/user-attachments/assets/78b262fc-1581-49f2-8c93-06d591b525c6)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744304977486.png)
Alternatively, you can manually import the resources by following these steps:
1. First, you must import [TMP Essential Resources](https://docs.unity3d.com/Packages/com.unity.textmeshpro@3.0/manual/index.html#installation) before using.
![](https://github.com/user-attachments/assets/70653ccf-0b5e-4352-ac62-76bdd49c5f92)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744305000411.png)
2. Open the `Package Manager` window and select the `UI Effect` package in the package list and click the `TextMeshPro Support > Import` button.
⚠️ If you are using `Unity 2023.2/6000.0+` or `TextMeshPro 3.2/4.0+`, click the `TextMeshPro Support (Unity 6) > Import` button instead.
![](https://github.com/user-attachments/assets/a1b246d3-3a0b-4a70-a9d2-3e75429fa757)
3. The assets will be imported under `Assets/Samples/UI Effect/{version}`.
4. Add the `UIEffect` component to a TextMeshProUGUI element and adjust the effect settings. The `<font>` and `<sprite>` tags are also supported.
![](https://github.com/user-attachments/assets/bfd28f36-2e32-4383-8628-276b02579fd4)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744305022250.png)
> [!TIP]
> `TextMeshPro Support` may change with updates to the UIEffect package.
> If issues occur, try importing it again.
> [!TIP]
> If you have moved `TMPro_Properties.cginc` and `TMPro.cginc` from their default install path
> (`Assets/TextMesh Pro/Shaders/...`), you will need to manually update the paths in the shaders under
> `TextMeshPro Support` or `TextMeshPro Support (Unity 6)`.
<br><br>
### Usage with SoftMaskForUGUI
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744305036318.png)
[SoftMaskForUGUI](https://github.com/mob-sakai/SoftMaskForUGUI) is a package that allows you to create soft masks for UI elements.
`SoftMaskForUGUI (v3.3.0+)` supports `UIEffect (v5.7.0+)`.
When a shader included in the samples is requested, an import dialog will automatically appear.
Click the `Import` button.
<br><br>
### Usage with ShaderGraph
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744307236288.png)
To use UIEffect with ShaderGraph, you need to import additional resources.
1. Open the `Package Manager` window and select the `UI Effect` package in the package list and click the `ShaderGraph Support (Unity6, BuiltIn) > Import` button.
⚠️ If you are using Universal Render Pipeline (URP), click the `ShaderGraph Support (Unity6, URP) > Import` button.
2. The assets will be imported under `Assets/Samples/UI Effect/{version}`.
3. Change the sub target (Material) of the existing ShaderGraph file to `Canvas (UIEffect)`.
Alternatively, create a new ShaderGraph from `Assets/Create/Shader Graph/BuiltIn/Canvas Shader Graph (UIEffect)`.
> [!TIP]
> Use `(UIEffect)` in the shader name or register as an optional shader in [ProjectSettings](#project-settings).
<br><br>
### Runtime/Editor Preset for UIEffect
![](https://github.com/user-attachments/assets/4244d162-a768-463e-8aad-8cafbdf3a5b3)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-preset.png)
You can create and use presets for `UIEffect` components.
- In the `UIEffect` component inspector, click "Save As" button to save the current settings as an editor preset.
- Click "Load" button to apply an editor preset.
- Click the `Load` button to apply an editor preset.
- Click the `Append` button to load only non-default settings from the editor preset.
- Click the `Save As New` button to save the current settings as an editor preset.
- In the [Project Settings](#project-settings), you can register saved editor presets as runtime presets.
- Runtime presets can be loaded using the `UIEffect.LoadPreset(presetName)` method.
@@ -368,7 +540,7 @@ You can control the effect settings and animations via code.
```csharp
var effect = graphic.AddComponent<UIEffect>();
// Apply a preset
// Apply a runtime preset
effect.LoadPreset("Dissolve");
// Set the effect parameters
@@ -388,16 +560,23 @@ UIEffectProjectSettings.shaderVariantCollection.WarmUp();
### Project Settings
![](https://github.com/user-attachments/assets/c50ed6fc-9577-4c85-9b38-89ed8571a8b0)
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744799623192.png)
You can adjust the project-wide settings for UIEffect. (`Edit > Project Settings > UI > UIEffect`)
#### Settings
- **Transform Sensitivity**: `Low`, `Medium`, `High`
- Set the sensitivity of the transformation when `Use Target Transform` is enabled in `UIEffectReplica` component.
- **Runtime Presets**: A list of presets that can be loaded at runtime. Load them using `UIEffect.LoadPreset(presetName)` method.
> [!IMPORTANT]
> - The legacy prefab-based preset system is deprecated as of v5.8.0.
> - If your project contains legacy presets, you can convert them to the new system.
> - **Convert All Legacy Presets**: Creates new presets based on the legacy ones.
> If the legacy presets are used as runtime presets, they will be replaced with the new ones.
> You can load the new preset via the `UIEffect.LoadPreset` method.
> - **Delete All Legacy Presets**: Deletes all legacy presets. If any legacy presets are assigned to `UIEffectReplica.target`, those targets will also be removed.
> ![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744792792701.png)
#### Editor
- **Use HDR Color Picker**: If enabled, the HDR color picker will be used in the inspector.
@@ -418,6 +597,10 @@ You can adjust the project-wide settings for UIEffect. (`Edit > Project Settings
- **Error On Unregistered Variant**: If enabled, an error will be displayed when an unregistered shader variant is used.
- The shader variant will be automatically added to the `Unregistered Variants` list.
> [!IMPORTANT]
> - 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`.
<br><br>
### :warning: Limitations
@@ -462,7 +645,6 @@ Your support allows me to dedicate more time to development. 😊
## License
* MIT
* © UTJ/UCL
## Author
@@ -473,4 +655,4 @@ Your support allows me to dedicate more time to development. 😊
* GitHub page : https://github.com/mob-sakai/UIEffect
* Releases : https://github.com/mob-sakai/UIEffect/releases
* Issue tracker : https://github.com/mob-sakai/UIEffect/issues
* Change log : https://github.com/mob-sakai/UIEffect/blob/main/Packages/src/CHANGELOG.md
* Change log : https://github.com/mob-sakai/UIEffect/blob/main/Packages/src/CHANGELOG.md
Binary file not shown.
+33 -1
View File
@@ -1,4 +1,5 @@
using UnityEngine.Rendering;
using System;
using UnityEngine.Rendering;
namespace Coffee.UIEffects
{
@@ -25,6 +26,17 @@ namespace Coffee.UIEffects
Contrast = 8
}
public enum GradationColorFilter
{
None = ColorFilter.None,
Multiply = ColorFilter.Multiply,
Additive = ColorFilter.Additive,
Subtractive = ColorFilter.Subtractive,
Replace = ColorFilter.Replace,
MultiplyLuminance = ColorFilter.MultiplyLuminance,
MultiplyAdditive = ColorFilter.MultiplyAdditive
}
public enum SamplingFilter
{
None = 0,
@@ -107,6 +119,26 @@ namespace Coffee.UIEffects
AngleGradient = 10
}
public enum DetailFilter
{
None = 0,
Masking = 1,
Multiply = 2,
Additive = 3,
Subtractive = 6,
Replace = 4,
MultiplyAdditive = 5
}
[Flags]
public enum Flip
{
Horizontal = 1 << 0,
Vertical = 1 << 1,
Effect = 1 << 2,
Shadow = 1 << 3
}
internal static class BlendTypeConverter
{
public static (BlendMode, BlendMode) Convert(this (BlendType type, BlendMode src, BlendMode dst) self)
@@ -204,7 +204,7 @@ namespace Coffee.UIEffectInternal
target.enabled = false;
// Find MonoScript of the specified component.
foreach (var script in Resources.FindObjectsOfTypeAll<MonoScript>())
foreach (var script in MonoImporter.GetAllRuntimeMonoScripts())
{
if (script.GetClass() != typeof(T))
{
@@ -1,3 +1,4 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -110,10 +111,12 @@ namespace Coffee.UIEffectInternal
dst.Clear();
for (var i = 0; i < vertexCount; i++)
{
dst.AddVert(positions[i], colors[i], uv0[i], uv1[i], normals[i], tangents[i]);
dst.AddVert(positions.GetOrDefault(i), colors.GetOrDefault(i), uv0.GetOrDefault(i), uv1.GetOrDefault(i),
normals.GetOrDefault(i), tangents.GetOrDefault(i));
}
for (var i = 0; i < indexCount; i += 3)
var count = Mathf.Clamp(indexCount, 0, indices.Count);
for (var i = 0; i < count - 2; i += 3)
{
dst.AddTriangle(indices[i], indices[i + 1], indices[i + 2]);
}
@@ -126,5 +129,12 @@ namespace Coffee.UIEffectInternal
InternalListPool<Color32>.Return(ref colors);
InternalListPool<int>.Return(ref indices);
}
private static T GetOrDefault<T>(this List<T> self, int index)
{
return 0 <= index && index < self.Count
? self[index]
: default;
}
}
}
@@ -0,0 +1,75 @@
#if UNITY_EDITOR
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEngine;
namespace Coffee.UIEffectInternal
{
public class CgincPathSync : AssetPostprocessor
{
private static string[] s_ShaderNames = null;
private static string s_CgincPattern = null;
public static void RegisterShaders(string cgincPattern, string[] shaderNames)
{
s_CgincPattern = cgincPattern;
s_ShaderNames = shaderNames;
UpdateTmpCgincPath();
}
private static void OnPostprocessAllAssets(string[] _, string[] __, string[] ___, string[] ____)
{
UpdateTmpCgincPath();
}
private static void UpdateTmpCgincPath()
{
if (s_CgincPattern == null || s_ShaderNames == null || s_ShaderNames.Length == 0) return;
AssetDatabase.StartAssetEditing();
string[] cgincs = null;
foreach (var shaderName in s_ShaderNames)
{
var shader = Shader.Find(shaderName);
if (!shader) continue;
var hasCgincError = ShaderUtil.GetShaderMessages(shader)
.Any(x => Regex.IsMatch(x.message, $"Couldn't open include file.*{s_CgincPattern}"));
if (!hasCgincError) continue;
cgincs = cgincs ?? AssetDatabase.FindAssets("t:ShaderInclude")
.Select(AssetDatabase.GUIDToAssetPath)
.Where(x => Regex.IsMatch(x, s_CgincPattern))
.ToArray();
UpdateTmpCgincPath(shader, cgincs);
}
AssetDatabase.StopAssetEditing();
}
private static void UpdateTmpCgincPath(Shader shader, string[] cgincs)
{
var path = AssetDatabase.GetAssetPath(shader);
var text = File.ReadAllText(path);
var hash = text.GetHashCode();
foreach (var cginc in cgincs)
{
var file = Path.GetFileName(cginc);
text = Regex.Replace(text, $"#include.*\"[^\"]*{file}\"", $"#include \"{cginc}\"",
RegexOptions.Multiline);
}
if (hash == text.GetHashCode()) return;
Debug.Log($"Update Shader: '{path}'");
File.WriteAllText(path, text, Encoding.UTF8);
AssetDatabase.ImportAsset(path);
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b39275b24ae5648d5a67a308a9127e81
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -3,11 +3,16 @@ using System.Diagnostics;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
#if UNITY_EDITOR && UNITY_2021_2_OR_NEWER
#if UNITY_EDITOR
using System.IO;
using System.Linq;
using System.Reflection;
#if UNITY_2021_2_OR_NEWER
using UnityEditor.SceneManagement;
#elif UNITY_EDITOR
#else
using UnityEditor.Experimental.SceneManagement;
#endif
#endif
namespace Coffee.UIEffectInternal
{
@@ -72,5 +77,56 @@ namespace Coffee.UIEffectInternal
public static bool isBatchOrBuilding => Application.isBatchMode || BuildPipeline.isBuildingPlayer;
#endif
[Conditional("UNITY_EDITOR")]
public static void QueuePlayerLoopUpdate()
{
#if UNITY_EDITOR
if (!EditorApplication.isPlaying)
{
EditorApplication.QueuePlayerLoopUpdate();
}
#endif
}
}
#if !UNITY_2021_2_OR_NEWER
[AttributeUsage(AttributeTargets.Class)]
[Conditional("UNITY_EDITOR")]
internal class IconAttribute : Attribute
{
private readonly string _path;
public IconAttribute(string path)
{
_path = path;
}
#if UNITY_EDITOR
private static Action<Object, Texture2D> s_SetIconForObject = typeof(EditorGUIUtility)
.GetMethod("SetIconForObject", BindingFlags.Static | BindingFlags.NonPublic)
.CreateDelegate(typeof(Action<Object, Texture2D>), null) as Action<Object, Texture2D>;
[InitializeOnLoadMethod]
private static void InitializeOnLoadMethod()
{
if (Misc.isBatchOrBuilding) return;
var types = TypeCache.GetTypesWithAttribute<IconAttribute>();
var scripts = MonoImporter.GetAllRuntimeMonoScripts();
foreach (var type in types)
{
var script = scripts.FirstOrDefault(x => x.GetClass() == type);
if (!script) continue;
var path = type.GetCustomAttribute<IconAttribute>()?._path;
var icon = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
if (!icon) continue;
s_SetIconForObject(script, icon);
}
}
#endif
}
#endif
}
@@ -1,10 +1,12 @@
using System;
using System.Diagnostics;
using UnityEditor;
using UnityEngine;
namespace Coffee.UIEffectInternal
{
[AttributeUsage(AttributeTargets.Field)]
[Conditional("UNITY_EDITOR")]
public sealed class PowerRangeAttribute : PropertyAttribute
{
public readonly float min;
@@ -0,0 +1,172 @@
#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using System.Linq;
using UnityEditor;
using UnityEditor.PackageManager.UI;
using PackageInfo = UnityEditor.PackageManager.PackageInfo;
namespace Coffee.UIEffectInternal
{
internal static class ShaderSampleImporter
{
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 RegisterShaderSamples((string shaderName, string sampleName, string version)[] samples)
{
if (IsBatchOrBuilding()) return;
// Collect sample names.
s_Samples = samples;
foreach (var (shaderName, sampleName, _) in samples)
{
s_SampleNames[shaderName] = sampleName;
}
}
public static void RegisterShaderAliases((string, string)[] aliases)
{
foreach (var (from, to) in aliases)
{
s_ShaderAliases[from] = to;
}
}
public static void RegisterDeprecatedShaders((string, string)[] deprecatedShaders)
{
if (IsBatchOrBuilding()) return;
s_DeprecatedShaders = deprecatedShaders;
}
/// <summary>
/// Import the sample containing the requested shader.
/// If choice 'Import' is selected, the sample is imported.
/// If choice 'Skip in this session' is selected, the sample is skipped in this session.
/// </summary>
public static bool ImportShaderIfSelected(string shaderName)
{
if (IsBatchOrBuilding()) return false;
if (s_ShaderAliases.TryGetValue(shaderName, out var alias))
{
shaderName = alias;
}
// Find sample name.
if (s_SampleNames.TryGetValue(shaderName, out var sampleName))
{
var message = $"Import the sample '{sampleName}' to use the shader '{shaderName}'.";
return ImportSampleIfSelected(sampleName, message);
}
return false;
}
private static bool ImportSampleIfSelected(string sampleName, string message)
{
if (IsBatchOrBuilding()) return false;
if (!s_SampleNames.ContainsValue(sampleName)) return false;
// Find package info.
var pInfo = PackageInfo.FindForAssembly(typeof(ShaderSampleImporter).Assembly);
if (pInfo == null) return false;
// Find sample. If not found (resolvedPath == null), skip.
var sample = Sample.FindByPackage(pInfo.name, pInfo.version)
.FirstOrDefault(x => x.displayName == sampleName);
if (sample.resolvedPath == null) return false;
// Import the sample if selected.
if (!string.IsNullOrEmpty(message))
{
var selected = EditorUtility.DisplayDialog($"Import {sampleName}", message, "Import", "Cancel");
if (!selected) return false;
}
// Remove the imported sample name from the list.
foreach (var shaderName in s_SampleNames.Keys.ToArray())
{
if (s_SampleNames[shaderName] != sampleName) continue;
s_SampleNames.Remove(shaderName);
DeleteShader(shaderName);
}
// Import the sample in the next frame.
EditorApplication.delayCall += () => sample.Import(Sample.ImportOptions.OverridePreviousImports);
return true;
}
private static string GetVersion(string shaderName)
{
if (string.IsNullOrEmpty(shaderName)) return null;
var shader = Shader.Find(shaderName);
if (!shader) return null;
var path = AssetDatabase.GetAssetPath(shader);
if (string.IsNullOrEmpty(path)) return null;
return AssetImporter.GetAtPath(path).userData;
}
private static void DeleteShader(string shaderName)
{
var shader = Shader.Find(shaderName);
if (shader)
{
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(shader));
}
}
private static bool IsBatchOrBuilding()
{
return Application.isBatchMode || BuildPipeline.isBuildingPlayer;
}
public static void Update()
{
if (s_Samples == null || IsBatchOrBuilding()) return;
// Find package info.
var pInfo = PackageInfo.FindForAssembly(typeof(ShaderSampleImporter).Assembly);
if (pInfo == null) return;
// Find sample. If not found (resolvedPath == null), skip.
var sample = Sample.FindByPackage(pInfo.name, pInfo.version).FirstOrDefault();
if (sample.resolvedPath == null) return;
// Update the sample.
foreach (var (shaderName, sampleName, version) in s_Samples)
{
if (string.IsNullOrEmpty(version)) continue;
if (!s_SampleNames.ContainsValue(sampleName)) continue;
// If the shader exist and the version is different, add the sample to the update list.
var currentVersion = GetVersion(shaderName);
if (currentVersion != null && currentVersion != version && ImportSampleIfSelected(sampleName, null))
{
Debug.Log($"Updating '{sampleName}' to use the package '{pInfo.displayName} v{pInfo.version}'.");
}
}
// Remove deprecated shaders.
foreach (var (guid, fileName) in s_DeprecatedShaders)
{
var path = AssetDatabase.GUIDToAssetPath(guid);
if (!string.IsNullOrEmpty(path) && Path.GetFileName(path) == fileName)
{
AssetDatabase.DeleteAsset(path);
}
}
s_Samples = null;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 763d620015bc94d7ab423f3b42aabf1e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -8,7 +8,6 @@ using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEditor.PackageManager.UI;
using UnityEditorInternal;
using PackageInfo = UnityEditor.PackageManager.PackageInfo;
using Object = UnityEngine.Object;
@@ -63,6 +62,7 @@ namespace Coffee.UIEffectInternal
#endif
public ShaderVariantCollection shaderVariantCollection => m_Asset;
public Func<string, bool> onShaderRequested;
public Shader FindOptionalShader(Shader shader,
string requiredName,
@@ -78,16 +78,16 @@ namespace Coffee.UIEffectInternal
return Shader.Find(optionalShaderName);
}
// The shader has
if (shader.name.Contains(requiredName))
// The shader has required name.
var shaderName = shader.name;
if (shaderName.Contains(requiredName))
{
_cachedOptionalShaders[id] = shader.name;
_cachedOptionalShaders[id] = shaderName;
return shader;
}
// Find optional shader.
Shader optionalShader;
var shaderName = shader.name;
foreach (var pair in m_OptionalShaders)
{
if (pair.key != shaderName) continue;
@@ -100,7 +100,7 @@ namespace Coffee.UIEffectInternal
}
// Find optional shader by format.
optionalShaderName = string.Format(format, shader.name);
optionalShaderName = string.Format(format, shaderName);
optionalShader = Shader.Find(optionalShaderName);
if (optionalShader)
{
@@ -109,7 +109,10 @@ namespace Coffee.UIEffectInternal
}
#if UNITY_EDITOR
ImportFromSample(optionalShaderName);
if (onShaderRequested?.Invoke(optionalShaderName) ?? false)
{
return Shader.Find(defaultOptionalShaderName);
}
#endif
// Find default optional shader.
@@ -119,83 +122,67 @@ namespace Coffee.UIEffectInternal
#if UNITY_EDITOR
private readonly HashSet<StringPair> _logVariants = new HashSet<StringPair>();
private readonly Dictionary<string, string> _sampleNames = new Dictionary<string, string>();
/// <summary>
/// Import the sample containing the requested shader.
/// If choice 'Import' is selected, the sample is imported.
/// If choice 'Skip in this session' is selected, the sample is skipped in this session.
/// </summary>
public void ImportFromSample(string shaderName)
{
if (Misc.isBatchOrBuilding) return;
// Find sample name.
if (_sampleNames.TryGetValue(shaderName, out var sampleName))
{
// Find package info.
var pInfo = PackageInfo.FindForAssembly(typeof(ShaderVariantRegistry).Assembly);
if (pInfo == null) return;
// Find sample. If not found (resolvedPath == null), skip.
var sample = Sample.FindByPackage(pInfo.name, pInfo.version)
.FirstOrDefault(x => x.displayName == sampleName);
if (sample.resolvedPath == null) return;
// Import the sample if selected.
var importSelected = EditorUtility.DisplayDialog($"Import {sampleName}",
$"Import '{sampleName}' to use the shader '{shaderName}'", "Import", "Cancel");
if (importSelected)
{
EditorApplication.delayCall += () =>
{
sample.Import();
};
}
}
}
public void ClearCache()
{
_cachedOptionalShaders.Clear();
}
public void RegisterSamples((string shaderName, string sampleName)[] samples)
/// <summary>
/// Register all optional shaders associated with the package.
/// If the shader file has a comment "// [OptionalShader] {packageName}: {shaderName}", it will be registered.
/// </summary>
public void RegisterOptionalShaders(Object owner)
{
foreach (var (shaderName, sampleName) in samples)
var shaderPaths = ShaderUtil.GetAllShaderInfo()
.Select(s => AssetDatabase.GetAssetPath(Shader.Find(s.name)))
.Where(path => !string.IsNullOrEmpty(path) && path.EndsWith(".shader"))
.ToArray();
foreach (var path in shaderPaths)
{
_sampleNames[shaderName] = sampleName;
RegisterOptionalShaders(owner, path);
}
}
public void InitializeIfNeeded(Object owner, string optionalName)
/// <summary>
/// Register optional shaders associated with the package.
/// If the shader file has a comment "// [OptionalShader] {packageName}: {shaderName}", it will be registered.
/// </summary>
private void RegisterOptionalShaders(Object owner, string path)
{
Profiler.BeginSample("(EDITOR/COF)[ShaderVariantRegistry] InitializeIfNeeded");
if (!File.Exists(path) || !path.EndsWith(".shader")) return;
var packageName = PackageInfo.FindForAssembly(typeof(ShaderVariantRegistry).Assembly)?.name;
if (string.IsNullOrEmpty(packageName)) return;
// Register optional shader names by shader comment.
if (!string.IsNullOrEmpty(optionalName))
var pattern = $"// \\[OptionalShader\\] {packageName}: (.*)$";
var registeredKeys = new HashSet<string>(m_OptionalShaders.Select(x => x.key));
var keys = File.ReadLines(path)
.Take(10)
.Select(line => Regex.Match(line, pattern))
.Where(match => match.Success && registeredKeys.Add(match.Groups[1].Value))
.Select(match => match.Groups[1].Value)
.ToArray();
if (0 < keys.Length)
{
var optionalShaders = ShaderUtil.GetAllShaderInfo()
.Where(s => s.name.Contains(optionalName))
.Select(s => (s.name, path: AssetDatabase.GetAssetPath(Shader.Find(s.name))))
.Where(x => !string.IsNullOrEmpty(x.path))
.SelectMany(x =>
{
return File.ReadLines(x.path)
.Take(10)
.Where(line => line.Contains($"OptionalShader@{optionalName}"))
.Select(line => Regex.Match(line, @":\s*(.*)$"))
.Where(match => match.Success)
.Select(match => new StringPair() { key = match.Groups[1].Value, value = x.name });
})
.Where(pair => m_OptionalShaders.All(x => x.key != pair.key))
.ToArray();
if (0 < optionalShaders.Length)
// Find shader.
var shader = AssetDatabase.LoadAssetAtPath<Shader>(path);
if (!shader) return;
var shaderName = shader.name;
foreach (var key in keys)
{
m_OptionalShaders.AddRange(optionalShaders);
EditorUtility.SetDirty(owner);
m_OptionalShaders.Add(new StringPair() { key = key, value = shaderName });
}
EditorUtility.SetDirty(owner);
}
}
public void InitializeIfNeeded(Object owner)
{
Profiler.BeginSample("(EDITOR/COF)[ShaderVariantRegistry] InitializeIfNeeded");
if (!m_Asset && AssetDatabase.IsMainAsset(owner))
{
@@ -284,9 +271,10 @@ namespace Coffee.UIEffectInternal
private readonly ReorderableList _rlOptionalShaders;
private readonly ReorderableList _rlUnregisteredVariants;
private Editor _editor;
private bool _expand;
private bool _expandOptionalShaders;
private bool _expandUnregisteredVariants;
public ShaderVariantRegistryEditor(SerializedProperty property, string optionName)
public ShaderVariantRegistryEditor(SerializedProperty property, string optionName, Action onFindOptions)
{
var so = property.serializedObject;
var optionalShaders = property.FindPropertyRelative("m_OptionalShaders");
@@ -294,16 +282,22 @@ namespace Coffee.UIEffectInternal
_errorOnUnregisteredVariant = property.FindPropertyRelative("m_ErrorOnUnregisteredVariant");
_asset = property.FindPropertyRelative("m_Asset");
_rlOptionalShaders = new ReorderableList(so, optionalShaders, false, true, true, true);
_rlOptionalShaders = new ReorderableList(so, optionalShaders, true, true, true, true);
_rlOptionalShaders.drawHeaderCallback = rect =>
{
var rLabel = new Rect(rect.x, rect.y, rect.width - 80, rect.height);
EditorGUI.LabelField(rLabel,
_expandOptionalShaders = EditorGUI.Foldout(rLabel, _expandOptionalShaders,
EditorGUIUtility.TrTextContent($"Optional Shaders {optionName}",
"Specify optional shaders explicitly."));
var rButton = new Rect(rect.x + rect.width - 80, rect.y, 80, rect.height - 4);
if (GUI.Button(rButton, "Clear All", EditorStyles.miniButton))
var rButton1 = new Rect(rect.x + rect.width - 150, rect.y, 90, rect.height - 4);
if (GUI.Button(rButton1, "Find Options", EditorStyles.miniButton))
{
onFindOptions?.Invoke();
}
var rButton2 = new Rect(rect.x + rect.width - 60, rect.y, 60, rect.height - 4);
if (GUI.Button(rButton2, "Clear All", EditorStyles.miniButton))
{
optionalShaders.ClearArray();
}
@@ -322,16 +316,16 @@ namespace Coffee.UIEffectInternal
var rKey = new Rect(r.x, r.y + 2, r.width, h);
if (GUI.Button(rKey, key.stringValue, EditorStyles.popup))
{
ShowShaderDropdown(key, optionName, false);
ShowShaderDropdown(key);
}
var rArrow = new Rect(r.x, r.y + h + 4, 20, h);
EditorGUI.LabelField(rArrow, "->");
EditorGUI.LabelField(rArrow, GUIContent.none, "ArrowNavigationRight");
var rValue = new Rect(r.x + 20, r.y + h + 4, r.width - 20, h);
if (GUI.Button(rValue, value.stringValue, EditorStyles.popup))
{
ShowShaderDropdown(value, optionName, true);
ShowShaderDropdown(value);
}
};
@@ -346,7 +340,7 @@ namespace Coffee.UIEffectInternal
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 - 80, rect.y, 80, rect.height - 4);
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();
@@ -383,8 +377,8 @@ namespace Coffee.UIEffectInternal
public void Draw()
{
_rlOptionalShaders.DoLayoutList();
_expand = DrawRegisteredShaderVariants(_expand, _asset, ref _editor);
DrawOptionalShaders(ref _expandOptionalShaders, _rlOptionalShaders);
DrawRegisteredShaderVariants(ref _expandUnregisteredVariants, _asset, ref _editor);
if (0 < _rlUnregisteredVariants.serializedProperty.arraySize)
{
EditorGUILayout.Space(4);
@@ -413,20 +407,40 @@ namespace Coffee.UIEffectInternal
EditorUtility.SetDirty(collection);
}
private static bool DrawRegisteredShaderVariants(bool expand, SerializedProperty property, ref Editor editor)
private static void DrawOptionalShaders(ref bool expand, ReorderableList list)
{
if (expand)
{
list.DoLayoutList();
}
else
{
var r = EditorGUILayout.GetControlRect(false, 20);
var rBg = new Rect(r.x - 3, r.y, r.width + 6, r.height);
EditorGUI.LabelField(rBg, GUIContent.none, "RL Header");
r.x += 3;
r.width -= 3;
r.y += 0;
list.drawHeaderCallback.Invoke(r);
}
}
private static void DrawRegisteredShaderVariants(ref bool expand, SerializedProperty property,
ref Editor editor)
{
var collection = property.objectReferenceValue as ShaderVariantCollection;
if (collection == null) return expand;
if (collection == null) return;
EditorGUILayout.Space();
var r = EditorGUILayout.GetControlRect(false, 20);
var rBg = new Rect(r.x - 3, r.y, r.width + 6, r.height);
EditorGUI.LabelField(rBg, GUIContent.none, "RL Header");
var rLabel = new Rect(r.x + 5, r.y, 200, r.height);
var rLabel = new Rect(r.x + 3, r.y, 200, r.height);
expand = EditorGUI.Foldout(rLabel, expand, "Registered Shader Variants");
var rButton = new Rect(r.x + r.width - 82, r.y + 1, 80, r.height - 4);
var rButton = new Rect(r.x + r.width - 62, r.y + 1, 60, r.height - 4);
if (GUI.Button(rButton, "Clear All", EditorStyles.miniButton))
{
collection.Clear();
@@ -438,24 +452,22 @@ namespace Coffee.UIEffectInternal
Editor.CreateCachedEditor(collection, null, ref editor);
editor.serializedObject.Update();
var shaders = editor.serializedObject.FindProperty("m_Shaders");
var drawShaderEntry = s_MiDrawShaderEntry?.CreateDelegate(typeof(Action<int>), editor) as Action<int>;
for (var i = 0; i < shaders.arraySize; i++)
{
s_MiDrawShaderEntry.Invoke(editor, new object[] { i });
drawShaderEntry?.Invoke(i);
}
EditorGUILayout.EndVertical();
editor.serializedObject.ApplyModifiedProperties();
}
return expand;
}
private static void ShowShaderDropdown(SerializedProperty property, string option, bool required)
private static void ShowShaderDropdown(SerializedProperty property)
{
var menu = new GenericMenu();
var current = property.stringValue;
var allShaderNames = ShaderUtil.GetAllShaderInfo()
.Where(s => !required || s.name.Contains(option))
.Select(s => s.name);
foreach (var shaderName in allShaderNames)
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -5,7 +5,7 @@ MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 5b93acc4527c740459bbfbd3404191be, type: 3}
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+90 -19
View File
@@ -1,3 +1,4 @@
using System;
using System.Runtime.CompilerServices;
using Coffee.UIEffectInternal;
using UnityEngine;
@@ -21,7 +22,12 @@ namespace Coffee.UIEffects
private Graphic _graphic;
private Material _material;
private UIEffectContext _context;
private Action _onBeforeCanvasRebuild;
private Action _onAfterCanvasRebuild;
private bool _canModifyMesh;
private Matrix4x4 _prevTransformHash;
public Material effectMaterial => _material;
public Graphic graphic => _graphic ? _graphic : _graphic = GetComponent<Graphic>();
public virtual uint effectId => (uint)GetInstanceID();
public virtual float actualSamplingScale => 1;
@@ -41,10 +47,27 @@ namespace Coffee.UIEffects
}
}
protected Material GetCurrentMaterial()
{
if (!isActiveAndEnabled) return null;
var g = graphic;
if (!g) return null;
var canvasRenderer = g.canvasRenderer;
if (!canvasRenderer || canvasRenderer.materialCount == 0) return null;
return canvasRenderer.GetMaterial();
}
public virtual RectTransform transitionRoot => transform as RectTransform;
protected override void OnEnable()
{
_onBeforeCanvasRebuild ??= OnBeforeCanvasRebuild;
_onAfterCanvasRebuild ??= OnAfterCanvasRebuild;
UIExtraCallbacks.onBeforeCanvasRebuild += _onBeforeCanvasRebuild;
UIExtraCallbacks.onAfterCanvasRebuild += _onAfterCanvasRebuild;
UpdateContext(context);
SetMaterialDirty();
SetVerticesDirty();
@@ -52,6 +75,16 @@ namespace Coffee.UIEffects
protected override void OnDisable()
{
if (_onBeforeCanvasRebuild != null)
{
UIExtraCallbacks.onBeforeCanvasRebuild -= _onBeforeCanvasRebuild;
}
if (_onAfterCanvasRebuild != null)
{
UIExtraCallbacks.onAfterCanvasRebuild -= _onAfterCanvasRebuild;
}
MaterialRepository.Release(ref _material);
SetMaterialDirty();
SetVerticesDirty();
@@ -59,9 +92,26 @@ namespace Coffee.UIEffects
protected override void OnDestroy()
{
_onBeforeCanvasRebuild = null;
_graphic = null;
s_ContextPool.Return(ref _context);
}
protected virtual void OnBeforeCanvasRebuild()
{
if (!_canModifyMesh && CanModifyMesh())
{
SetVerticesDirty();
}
}
protected virtual void OnAfterCanvasRebuild()
{
if (!_material || !graphic || !graphic.canvas || context == null) return;
context.UpdateViewMatrix(GetCurrentMaterial(), transitionRoot, graphic.canvas.rootCanvas);
}
public void ModifyMesh(Mesh mesh)
{
}
@@ -70,7 +120,23 @@ namespace Coffee.UIEffects
{
if (!isActiveAndEnabled || context == null) return;
context.ModifyMesh(graphic, transitionRoot, vh, canModifyShape);
_canModifyMesh = CanModifyMesh();
if (_canModifyMesh)
{
context.ModifyMesh(graphic, transitionRoot, vh, canModifyShape);
}
}
private bool CanModifyMesh()
{
// The transitionRoot is same as the transform => true.
var root = transitionRoot;
if (transform == root) return true;
// The transitionRoot is not visible => false.
var scale1 = root.lossyScale;
var scale2 = transform.lossyScale;
return !Mathf.Approximately(scale1.x * scale1.y * scale2.x * scale2.y, 0);
}
public virtual Material GetModifiedMaterial(Material baseMaterial)
@@ -83,7 +149,8 @@ namespace Coffee.UIEffects
Profiler.BeginSample("(UIE)[UIEffect] GetModifiedMaterial");
var samplingScaleId = (uint)(Mathf.InverseLerp(0.01f, 100, actualSamplingScale) * uint.MaxValue);
var hash = new Hash128((uint)baseMaterial.GetInstanceID(), effectId, samplingScaleId, 0);
var rootId = (uint)(transitionRoot ? transitionRoot.GetInstanceID() : 0);
var hash = new Hash128((uint)baseMaterial.GetInstanceID(), effectId, samplingScaleId, rootId);
if (!MaterialRepository.Valid(hash, _material))
{
Profiler.BeginSample("(UIE)[UIEffect] GetModifiedMaterial > Get or create material");
@@ -98,6 +165,7 @@ namespace Coffee.UIEffects
Profiler.EndSample();
}
_material.CopyPropertiesFromMaterial(baseMaterial);
ApplyContextToMaterial(_material);
Profiler.EndSample();
return _material;
@@ -107,20 +175,18 @@ namespace Coffee.UIEffects
protected override void OnValidate()
{
UpdateContext(context);
ApplyContextToMaterial(graphic ? graphic.canvasRenderer.GetMaterial() : _material);
SetVerticesDirty();
SetMaterialDirty();
if (!EditorApplication.isPlaying)
{
EditorApplication.QueuePlayerLoopUpdate();
}
}
protected override void Reset()
{
OnValidate();
}
internal virtual void SetEnablePreviewIfSelected(GameObject[] selection)
{
}
#endif
protected override void OnRectTransformDimensionsChange()
@@ -141,10 +207,8 @@ namespace Coffee.UIEffects
if (graphic)
{
graphic.SetVerticesDirty();
GraphicProxy.Find(graphic).SetVerticesDirty(graphic, false);
#if UNITY_EDITOR
EditorApplication.QueuePlayerLoopUpdate();
#endif
GraphicProxy.Find(graphic).SetVerticesDirty(graphic, enabled);
Misc.QueuePlayerLoopUpdate();
}
}
@@ -153,13 +217,16 @@ namespace Coffee.UIEffects
if (graphic)
{
graphic.SetMaterialDirty();
#if UNITY_EDITOR
EditorApplication.QueuePlayerLoopUpdate();
#endif
Misc.QueuePlayerLoopUpdate();
}
}
protected abstract void UpdateContext(UIEffectContext c);
internal void ReleaseMaterial()
{
MaterialRepository.Release(ref _material);
}
internal abstract void UpdateContext(UIEffectContext c);
public virtual void ApplyContextToMaterial(Material material)
{
@@ -168,11 +235,15 @@ namespace Coffee.UIEffects
context.ApplyToMaterial(material, actualSamplingScale);
#if UNITY_EDITOR
UIEffectProjectSettings.shaderRegistry.RegisterVariant(material, "UI > UIEffect");
if (!EditorApplication.isPlaying)
Profiler.BeginSample("(Editor/UIE)[UIEffect] ApplyContextToMaterial Post Process");
if (!Application.isPlaying)
{
EditorApplication.QueuePlayerLoopUpdate();
SetEnablePreviewIfSelected(Selection.gameObjects);
Misc.QueuePlayerLoopUpdate();
}
UIEffectProjectSettings.shaderRegistry.RegisterVariant(material, "UI > UIEffect");
Profiler.EndSample();
#endif
}
File diff suppressed because it is too large Load Diff
+178
View File
@@ -0,0 +1,178 @@
using Coffee.UIEffectInternal;
using UnityEngine;
using UnityEngine.Rendering;
namespace Coffee.UIEffects
{
[CreateAssetMenu]
[ExecuteAlways]
public class UIEffectPreset : ScriptableObject
{
public ToneFilter m_ToneFilter = ToneFilter.None;
[Range(0, 1)] public float m_ToneIntensity = 1;
public ColorFilter m_ColorFilter = ColorFilter.None;
[Range(0, 1)] public float m_ColorIntensity = 1;
public Color m_Color = Color.white;
public bool m_ColorGlow = false;
public SamplingFilter m_SamplingFilter = SamplingFilter.None;
[Range(0, 1)] public float m_SamplingIntensity = 0.5f;
[Range(0.5f, 10f)] public float m_SamplingWidth = 1;
public TransitionFilter m_TransitionFilter = TransitionFilter.None;
[Range(0, 1)] public float m_TransitionRate = 0.5f;
public bool m_TransitionReverse;
public Texture m_TransitionTex;
public Vector2 m_TransitionTexScale = new Vector2(1, 1);
public Vector2 m_TransitionTexOffset = new Vector2(0, 0);
public Vector2 m_TransitionTexSpeed = new Vector2(0, 0);
[Range(0, 360)] public float m_TransitionRotation = 0;
public bool m_TransitionKeepAspectRatio = true;
[Range(0, 1)] public float m_TransitionWidth = 0.2f;
[Range(0, 1)] public float m_TransitionSoftness = 0.2f;
public MinMax01 m_TransitionRange = new MinMax01(0, 1);
public ColorFilter m_TransitionColorFilter = ColorFilter.MultiplyAdditive;
public Color m_TransitionColor = new Color(0f, 0.5f, 1.0f, 1.0f);
public bool m_TransitionColorGlow = false;
public bool m_TransitionPatternReverse = false;
[Range(-5, 5)] public float m_TransitionAutoPlaySpeed = 0f;
public TargetMode m_TargetMode = TargetMode.None;
public Color m_TargetColor = Color.white;
[Range(0, 1)] public float m_TargetRange = 0.1f;
[Range(0, 1)] public float m_TargetSoftness = 0.5f;
public BlendType m_BlendType = BlendType.AlphaBlend;
public BlendMode m_SrcBlendMode = BlendMode.One;
public BlendMode m_DstBlendMode = BlendMode.OneMinusSrcAlpha;
public ShadowMode m_ShadowMode = ShadowMode.None;
public Vector2 m_ShadowDistance = new Vector2(1f, -1f);
[Range(1, 5)] public int m_ShadowIteration = 1;
[Range(0, 1)] public float m_ShadowFade = 0.9f;
[Range(0, 2)] public float m_ShadowMirrorScale = 0.5f;
[Range(0, 1)] public float m_ShadowBlurIntensity = 1;
public ColorFilter m_ShadowColorFilter = ColorFilter.Replace;
public Color m_ShadowColor = Color.white;
public bool m_ShadowColorGlow = false;
public GradationMode m_GradationMode = GradationMode.None;
[Range(0, 1)] public float m_GradationIntensity = 1;
public GradationColorFilter m_GradationColorFilter = GradationColorFilter.Multiply;
public Color m_GradationColor1 = Color.white;
public Color m_GradationColor2 = Color.white;
public Color m_GradationColor3 = Color.white;
public Color m_GradationColor4 = Color.white;
public Gradient m_GradationGradient = new Gradient();
[Range(-1, 1)] public float m_GradationOffset = 0;
[PowerRange(0.01f, 10, 10)] public float m_GradationScale = 1;
[Range(0, 360)] public float m_GradationRotation = 0;
public EdgeMode m_EdgeMode = EdgeMode.None;
[Range(0, 1)] public float m_EdgeWidth = 0.5f;
public ColorFilter m_EdgeColorFilter = ColorFilter.Replace;
public Color m_EdgeColor = Color.white;
public bool m_EdgeColorGlow = false;
[Range(0, 1)] public float m_EdgeShinyRate = 0.5f;
[Range(0, 1)] public float m_EdgeShinyWidth = 0.5f;
[Range(-5, 5)] public float m_EdgeShinyAutoPlaySpeed = 1f;
public PatternArea m_PatternArea = PatternArea.Inner;
public DetailFilter m_DetailFilter = DetailFilter.None;
[Range(0, 1)] public float m_DetailIntensity = 1;
public Color m_DetailColor = Color.white;
public MinMax01 m_DetailThreshold = new MinMax01(0, 1);
public Texture m_DetailTex;
public Vector2 m_DetailTexScale = new Vector2(1, 1);
public Vector2 m_DetailTexOffset = new Vector2(0, 0);
public Vector2 m_DetailTexSpeed = new Vector2(0, 0);
public Flip m_Flip = 0;
public void UpdateContext(UIEffectContext dst)
{
var src = this;
dst.m_ToneFilter = src.m_ToneFilter;
dst.m_ToneIntensity = src.m_ToneIntensity;
dst.m_ColorFilter = src.m_ColorFilter;
dst.m_Color = src.m_Color;
dst.m_ColorIntensity = src.m_ColorIntensity;
dst.m_ColorGlow = src.m_ColorGlow;
dst.m_SamplingFilter = src.m_SamplingFilter;
dst.m_SamplingIntensity = src.m_SamplingIntensity;
dst.m_SamplingWidth = src.m_SamplingWidth;
dst.m_TransitionFilter = src.m_TransitionFilter;
dst.m_TransitionRate = src.m_TransitionRate;
dst.m_TransitionReverse = src.m_TransitionReverse;
dst.m_TransitionTex = src.m_TransitionTex;
dst.m_TransitionTexScale = src.m_TransitionTexScale;
dst.m_TransitionTexOffset = src.m_TransitionTexOffset;
dst.m_TransitionTexSpeed = src.m_TransitionTexSpeed;
dst.m_TransitionRotation = src.m_TransitionRotation;
dst.m_TransitionKeepAspectRatio = src.m_TransitionKeepAspectRatio;
dst.m_TransitionWidth = src.m_TransitionWidth;
dst.m_TransitionSoftness = src.m_TransitionSoftness;
dst.m_TransitionRange = src.m_TransitionRange;
dst.m_TransitionColorFilter = src.m_TransitionColorFilter;
dst.m_TransitionColor = src.m_TransitionColor;
dst.m_TransitionColorGlow = src.m_TransitionColorGlow;
dst.m_TransitionPatternReverse = src.m_TransitionPatternReverse;
dst.m_TransitionAutoPlaySpeed = src.m_TransitionAutoPlaySpeed;
dst.m_TargetMode = src.m_TargetMode;
dst.m_TargetColor = src.m_TargetColor;
dst.m_TargetRange = src.m_TargetRange;
dst.m_TargetSoftness = src.m_TargetSoftness;
dst.m_SrcBlendMode = src.m_SrcBlendMode;
dst.m_DstBlendMode = src.m_DstBlendMode;
dst.m_ShadowMode = src.m_ShadowMode;
dst.m_ShadowDistance = src.m_ShadowDistance;
dst.m_ShadowIteration = src.m_ShadowIteration;
dst.m_ShadowFade = src.m_ShadowFade;
dst.m_ShadowMirrorScale = src.m_ShadowMirrorScale;
dst.m_ShadowBlurIntensity = src.m_ShadowBlurIntensity;
dst.m_ShadowColorFilter = src.m_ShadowColorFilter;
dst.m_ShadowColor = src.m_ShadowColor;
dst.m_ShadowColorGlow = src.m_ShadowColorGlow;
dst.m_EdgeMode = src.m_EdgeMode;
dst.m_EdgeShinyRate = src.m_EdgeShinyRate;
dst.m_EdgeWidth = src.m_EdgeWidth;
dst.m_EdgeColorFilter = src.m_EdgeColorFilter;
dst.m_EdgeColor = src.m_EdgeColor;
dst.m_EdgeColorGlow = src.m_EdgeColorGlow;
dst.m_EdgeShinyWidth = src.m_EdgeShinyWidth;
dst.m_EdgeShinyAutoPlaySpeed = src.m_EdgeShinyAutoPlaySpeed;
dst.m_PatternArea = src.m_PatternArea;
dst.m_GradationMode = src.m_GradationMode;
dst.m_GradationIntensity = src.m_GradationIntensity;
dst.m_GradationColorFilter = src.m_GradationColorFilter;
dst.m_GradationColor1 = src.m_GradationColor1;
dst.m_GradationColor2 = src.m_GradationColor2;
dst.m_GradationColor3 = src.m_GradationColor3;
dst.m_GradationColor4 = src.m_GradationColor4;
dst.m_GradationGradient = src.m_GradationGradient;
dst.m_GradationOffset = src.m_GradationOffset;
dst.m_GradationScale = src.m_GradationScale;
dst.m_GradationRotation = src.m_GradationRotation;
dst.m_DetailFilter = src.m_DetailFilter;
dst.m_DetailIntensity = src.m_DetailIntensity;
dst.m_DetailColor = src.m_DetailColor;
dst.m_DetailThreshold = src.m_DetailThreshold;
dst.m_DetailTex = src.m_DetailTex;
dst.m_DetailTexScale = src.m_DetailTexScale;
dst.m_DetailTexOffset = src.m_DetailTexOffset;
dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
dst.m_Flip = src.m_Flip;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c1b6988bc8fdf48b4896110606a86b61
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 5b93acc4527c740459bbfbd3404191be, type: 3}
userData:
assetBundleName:
assetBundleVariant:
+201 -65
View File
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -5,19 +6,19 @@ using System.Text.RegularExpressions;
using Coffee.UIEffectInternal;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
using Object = UnityEngine.Object;
namespace Coffee.UIEffects
{
public class UIEffectProjectSettings : PreloadedProjectSettings<UIEffectProjectSettings>
{
[Tooltip(
"The sensitivity of the transformation when `Use Target Transform` is enabled in the `UIEffectReplica` component.")]
[Header("Setting")]
[SerializeField]
private TransformSensitivity m_TransformSensitivity = TransformSensitivity.Medium;
internal List<UIEffect> m_RuntimePresets = new List<UIEffect>();
[SerializeField]
internal List<UIEffect> m_RuntimePresets = new List<UIEffect>();
internal List<UIEffectPreset> m_RuntimePresetsV2 = new List<UIEffectPreset>();
[Header("Editor")]
[Tooltip("Use HDR color pickers on color fields.")]
@@ -35,29 +36,24 @@ namespace Coffee.UIEffects
public static ShaderVariantCollection shaderVariantCollection => shaderRegistry.shaderVariantCollection;
public static TransformSensitivity transformSensitivity
{
get => instance.m_TransformSensitivity;
set => instance.m_TransformSensitivity = value;
}
public static bool useHdrColorPicker
{
get => instance.m_UseHDRColorPicker;
set => instance.m_UseHDRColorPicker = value;
}
public static void RegisterRuntimePreset(UIEffect effect)
public static void RegisterRuntimePreset(UIEffectPreset preset)
{
// Already registered.
if (!effect || LoadRuntimePreset(effect.name)) return;
if (!preset || instance.m_RuntimePresetsV2.Contains(preset)) return;
instance.m_RuntimePresets.Add(effect);
instance.m_RuntimePresetsV2.Add(preset);
#if UNITY_EDITOR
EditorUtility.SetDirty(instance);
#endif
}
[Obsolete("LoadRuntimePreset is obsolete. Use LoadPreset instead.", false)]
public static UIEffect LoadRuntimePreset(string presetName)
{
for (var i = 0; i < instance.m_RuntimePresets.Count; i++)
@@ -72,13 +68,19 @@ namespace Coffee.UIEffects
return null;
}
protected override void OnEnable()
public static Object LoadPreset(string presetName)
{
base.OnEnable();
#if UNITY_EDITOR
SetupSamplesForShaderVariantRegistry();
m_ShaderVariantRegistry.ClearCache();
#endif
for (var i = 0; i < instance.m_RuntimePresetsV2.Count; i++)
{
var preset = instance.m_RuntimePresetsV2[i];
if (preset && preset.name == presetName)
{
return preset;
}
}
#pragma warning disable CS0618
return LoadRuntimePreset(presetName);
#pragma warning restore CS0618
}
#if UNITY_EDITOR
@@ -86,48 +88,140 @@ namespace Coffee.UIEffects
private const string k_PresetSaveDir = "Assets/ProjectSettings/" + k_PresetDir;
private const string k_PresetPathPattern = "/" + k_PresetDir + "/(.*).prefab$";
[InitializeOnLoadMethod]
private static void InitializeOnLoadMethod()
{
#if UNITY_2023_2_OR_NEWER
const string tmpSupport = "TextMeshPro Support (Unity 6)";
const string version = "v5.8.0 (Unity 6)";
#else
const string tmpSupport = "TextMeshPro Support";
const string version = "v5.8.0";
#endif
ShaderSampleImporter.RegisterShaderSamples(new[]
{
// TextMeshPro Support/TextMeshPro Support (Unity 6)
("Hidden/TextMeshPro/Distance Field SSD (UIEffect)", tmpSupport, version),
("Hidden/TextMeshPro/Mobile/Distance Field SSD (UIEffect)", tmpSupport, version),
("Hidden/TextMeshPro/Distance Field Overlay (UIEffect)", tmpSupport, version),
("Hidden/TextMeshPro/Mobile/Distance Field Overlay (UIEffect)", tmpSupport, version),
("Hidden/TextMeshPro/Bitmap (UIEffect)", tmpSupport, version),
("Hidden/TextMeshPro/Mobile/Bitmap (UIEffect)", tmpSupport, version),
("Hidden/TextMeshPro/Distance Field (UIEffect)", tmpSupport, version),
("Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)", tmpSupport, version),
// ShaderGraph Support
("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.8.0"),
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.8.0")
});
ShaderSampleImporter.RegisterShaderAliases(new[]
{
("Hidden/Hidden/TextMeshPro/Distance Field SSD (SoftMaskable) (UIEffect)",
"Hidden/TextMeshPro/Distance Field SSD (UIEffect)"),
("Hidden/Hidden/TextMeshPro/Mobile/Distance Field SSD (SoftMaskable) (UIEffect)",
"Hidden/TextMeshPro/Mobile/Distance Field SSD (UIEffect)"),
("Hidden/Hidden/TextMeshPro/Distance Field Overlay (SoftMaskable) (UIEffect)",
"Hidden/TextMeshPro/Distance Field Overlay (UIEffect)"),
("Hidden/Hidden/TextMeshPro/Mobile/Distance Field Overlay (SoftMaskable) (UIEffect)",
"Hidden/TextMeshPro/Mobile/Distance Field Overlay (UIEffect)"),
("Hidden/Hidden/TextMeshPro/Bitmap (SoftMaskable) (UIEffect)",
"Hidden/TextMeshPro/Bitmap (UIEffect)"),
("Hidden/Hidden/TextMeshPro/Mobile/Bitmap (SoftMaskable) (UIEffect)",
"Hidden/TextMeshPro/Mobile/Bitmap (UIEffect)"),
("Hidden/Hidden/TextMeshPro/Distance Field (SoftMaskable) (UIEffect)",
"Hidden/TextMeshPro/Distance Field (UIEffect)"),
("Hidden/Hidden/TextMeshPro/Mobile/Distance Field (SoftMaskable) (UIEffect)",
"Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)")
});
ShaderSampleImporter.RegisterDeprecatedShaders(new[]
{
// Old shaders.
("367310b4ca95c4b00a2215568f1af735", "Hidden-TMP_Bitmap-Mobile-UIEffect-Unity6.shader"),
("490fe6c46146140cca8766a31c9dfc0c", "Hidden-TMP_Bitmap-UIEffect-Unity6.shader"),
("b875fa74fa43a4c48a44634d5f3e6d3d", "Hidden-TMP_SDF-Mobile-UIEffect-Unity6.shader"),
("c67f821adbb6348a3a21573a25b55de0", "Hidden-TMP_SDF-UIEffect-Unity6.shader")
});
EditorApplication.update += ShaderSampleImporter.Update;
CgincPathSync.RegisterShaders("/(TMPro|TMPro_Properties).cginc", new[]
{
"Hidden/TextMeshPro/Distance Field (UIEffect)",
"Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)",
"Hidden/TextMeshPro/Distance Field SSD (UIEffect)",
"Hidden/TextMeshPro/Mobile/Distance Field SSD (UIEffect)",
"Hidden/TextMeshPro/Distance Field Overlay (UIEffect)",
"Hidden/TextMeshPro/Mobile/Distance Field Overlay (UIEffect)",
"Hidden/TextMeshPro/Bitmap (UIEffect)",
"Hidden/TextMeshPro/Mobile/Bitmap (UIEffect)",
"Hidden/TextMeshPro/Distance Field (UIEffect)",
"Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)"
});
Selection.selectionChanged += () =>
{
if (Application.isPlaying || Misc.isBatchOrBuilding) return;
var selection = Selection.gameObjects;
foreach (var c in FindAll())
{
if (!c || !c.isActiveAndEnabled) continue;
c.SetEnablePreviewIfSelected(selection);
}
};
if (!Misc.isBatchOrBuilding)
{
// Enable the 'UIEFFECT_EDITOR' keyword only when drawing in the scene view camera.
RenderPipelineManager.beginCameraRendering += (_, c) => EnableEditorMode(true, c);
RenderPipelineManager.endCameraRendering += (_, c) => EnableEditorMode(false, c);
Camera.onPreRender += c => EnableEditorMode(true, c);
Camera.onPostRender += c => EnableEditorMode(false, c);
void EnableEditorMode(bool begin, Camera cam)
{
if (cam.cameraType == CameraType.SceneView)
{
if (begin)
{
Shader.EnableKeyword("UIEFFECT_EDITOR");
}
else
{
Shader.DisableKeyword("UIEFFECT_EDITOR");
}
}
}
}
}
private static IEnumerable<UIEffectBase> FindAll()
{
return Misc.FindObjectsOfType<UIEffectBase>()
.Concat(Misc.GetAllComponentsInPrefabStage<UIEffectBase>());
}
protected override void OnEnable()
{
base.OnEnable();
m_ShaderVariantRegistry.onShaderRequested = ShaderSampleImporter.ImportShaderIfSelected;
m_ShaderVariantRegistry.ClearCache();
}
protected override void OnCreateAsset()
{
m_ShaderVariantRegistry.InitializeIfNeeded(this, "(UIEffect)");
m_ShaderVariantRegistry.InitializeIfNeeded(this);
m_ShaderVariantRegistry.RegisterOptionalShaders(this);
}
protected override void OnInitialize()
{
m_ShaderVariantRegistry.InitializeIfNeeded(this, "(UIEffect)");
m_ShaderVariantRegistry.InitializeIfNeeded(this);
}
private void Reset()
{
m_ShaderVariantRegistry.InitializeIfNeeded(this, "(UIEffect)");
}
private void SetupSamplesForShaderVariantRegistry()
{
#if UNITY_2023_2_OR_NEWER
const string tmpSupport = "TextMeshPro Support (Unity 6)";
#else
const string tmpSupport = "TextMeshPro Support";
#endif
m_ShaderVariantRegistry.RegisterSamples(new[]
{
("Hidden/TextMeshPro/Bitmap (UIEffect)", tmpSupport),
("Hidden/TextMeshPro/Mobile/Bitmap (UIEffect)", tmpSupport),
("Hidden/TextMeshPro/Distance Field (UIEffect)", tmpSupport),
("Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)", tmpSupport)
});
}
private void Refresh()
{
m_ShaderVariantRegistry.ClearCache();
MaterialRepository.Clear();
foreach (var c in Misc.FindObjectsOfType<UIEffectBase>()
.Concat(Misc.GetAllComponentsInPrefabStage<UIEffectBase>()))
{
c.SetMaterialDirty();
}
EditorApplication.QueuePlayerLoopUpdate();
m_ShaderVariantRegistry.InitializeIfNeeded(this);
m_ShaderVariantRegistry.RegisterOptionalShaders(this);
}
internal static UIEffect[] LoadEditorPresets()
@@ -135,14 +229,30 @@ namespace Coffee.UIEffects
var dirs = AssetDatabase.FindAssets(k_PresetDir + " t:folder")
.Select(AssetDatabase.GUIDToAssetPath)
.Where(x => Path.GetFileName(x) == k_PresetDir)
.OrderBy(x => x.StartsWith("Packages/com.coffee.ui-effect/"))
.ToArray();
return AssetDatabase.FindAssets("t:prefab", dirs)
.Select(AssetDatabase.GUIDToAssetPath)
.OrderBy(x => AssetImporter.GetAtPath(x).userData)
.Select(AssetDatabase.LoadAssetAtPath<UIEffect>)
.Where(x => x)
.ToArray();
}
internal static UIEffectPreset[] LoadEditorPresetsV2()
{
var dirs = AssetDatabase.FindAssets(k_PresetDir + " t:folder")
.Select(AssetDatabase.GUIDToAssetPath)
.Where(x => Path.GetFileName(x) == k_PresetDir)
.OrderBy(x => x.StartsWith("Packages/com.coffee.ui-effect/"))
.ToArray();
return AssetDatabase.FindAssets("t:UIEffectPreset", dirs)
.Select(AssetDatabase.GUIDToAssetPath)
.OrderBy(x => AssetImporter.GetAtPath(x).userData)
.Select(AssetDatabase.LoadAssetAtPath<UIEffectPreset>)
.ToArray();
}
internal static void SaveAsNewPreset(UIEffect effect)
{
if (!Directory.Exists(k_PresetSaveDir))
@@ -150,18 +260,16 @@ namespace Coffee.UIEffects
Directory.CreateDirectory(k_PresetSaveDir);
}
var prefabPath = EditorUtility.SaveFilePanel("Save Preset", k_PresetSaveDir, effect.name, "prefab");
if (string.IsNullOrEmpty(prefabPath)) return;
var path = EditorUtility.SaveFilePanel("Save Preset", k_PresetSaveDir, effect.name, "asset");
if (string.IsNullOrEmpty(path)) return;
var prefab = new GameObject();
prefab.SetActive(false);
path = FileUtil.GetProjectRelativePath(path);
path = AssetDatabase.GenerateUniqueAssetPath(path);
var preset = prefab.AddComponent<UIEffect>();
preset.LoadPreset(effect);
var prefabAsset = PrefabUtility.SaveAsPrefabAsset(prefab, prefabPath);
EditorGUIUtility.PingObject(prefabAsset);
DestroyImmediate(prefab);
var preset = CreateInstance<UIEffectPreset>();
effect.SavePreset(preset, false);
AssetDatabase.CreateAsset(preset, path);
EditorGUIUtility.PingObject(preset);
}
[SettingsProvider]
@@ -170,20 +278,48 @@ namespace Coffee.UIEffects
return new PreloadedProjectSettingsProvider("Project/UI/UI Effect");
}
internal static string GetPresetPath(UIEffect preset)
internal static (string path, bool builtin) GetPresetPath(Object preset)
{
var assetPath = AssetDatabase.GetAssetPath(preset);
var builtin = assetPath.StartsWith("Packages/com.coffee.ui-effect/");
var m = Regex.Match(assetPath, k_PresetPathPattern);
return m.Success ? m.Groups[1].Value : Path.GetFileNameWithoutExtension(assetPath);
return (m.Success ? m.Groups[1].Value : Path.GetFileNameWithoutExtension(assetPath), builtin);
}
private class Postprocessor : AssetPostprocessor
{
private static void OnPostprocessAllAssets(string[] _, string[] __, string[] ___, string[] ____)
private static void OnPostprocessAllAssets(string[] imported, string[] deleted, string[] ___, string[] ____)
{
if (Misc.isBatchOrBuilding) return;
instance.Refresh();
// Register optional shaders when shaders are imported.
if (imported.Concat(deleted).Any(path => path.EndsWith(".shader")))
{
MaterialRepository.Clear();
// Refresh
if (hasInstance)
{
shaderRegistry.ClearCache();
shaderRegistry.RegisterOptionalShaders(instance);
}
// Refresh all UIEffect instances.
foreach (var c in FindAll())
{
c.ReleaseMaterial();
}
}
// Refresh all UIEffect instances.
EditorApplication.delayCall += () =>
{
foreach (var c in FindAll())
{
c.SetMaterialDirty();
c.SetVerticesDirty();
}
};
}
}
#endif
+133 -25
View File
@@ -1,11 +1,14 @@
using Coffee.UIEffectInternal;
using System.Linq;
using Coffee.UIEffectInternal;
using UnityEngine;
namespace Coffee.UIEffects
{
public class UIEffectReplica : UIEffectBase
[Icon("Packages/com.coffee.ui-effect/Editor/UIEffectIconIcon.png")]
public class UIEffectReplica : UIEffectBase, ISerializationCallbackReceiver
{
[SerializeField] private UIEffect m_Target;
[SerializeField] private UIEffectPreset m_Preset;
[SerializeField] private bool m_UseTargetTransform = true;
[PowerRange(0.01f, 100, 10f)]
@@ -15,8 +18,10 @@ namespace Coffee.UIEffects
[SerializeField]
protected bool m_AllowToModifyMeshShape = true;
[SerializeField]
protected RectTransform m_CustomRoot = null;
private UIEffect _currentTarget;
private Matrix4x4 _prevTransformHash;
public UIEffect target
{
@@ -25,12 +30,26 @@ namespace Coffee.UIEffects
{
if (m_Target == value) return;
m_Target = value;
m_Preset = null;
RefreshTarget(m_Target);
SetVerticesDirty();
SetMaterialDirty();
}
}
public UIEffectPreset preset
{
get => m_Preset;
set
{
if (m_Preset == value) return;
m_Preset = value;
RefreshTarget(null);
SetVerticesDirty();
SetMaterialDirty();
}
}
public bool useTargetTransform
{
get => m_UseTargetTransform;
@@ -42,6 +61,17 @@ namespace Coffee.UIEffects
}
}
public RectTransform customRoot
{
get => m_CustomRoot;
set
{
if (m_CustomRoot == value) return;
m_CustomRoot = value;
SetVerticesDirty();
}
}
public float samplingScale
{
get => m_SamplingScale;
@@ -54,38 +84,87 @@ namespace Coffee.UIEffects
}
}
public bool allowToModifyMeshShape
{
get => m_AllowToModifyMeshShape;
set
{
if (m_AllowToModifyMeshShape == value) return;
m_AllowToModifyMeshShape = value;
SetVerticesDirty();
}
}
public override float actualSamplingScale => Mathf.Clamp(m_SamplingScale, 0.01f, 100);
public override bool canModifyShape => m_AllowToModifyMeshShape;
public override uint effectId => target ? target.effectId : 0;
public override UIEffectContext context => target && target.isActiveAndEnabled ? target.context : null;
public override RectTransform transitionRoot => useTargetTransform && target
public override UIEffectContext context
{
get
{
// Following the preset/preset-target.
if (preset || (target && !isTargetInScene)) return base.context;
// Following the instantiated target.
return target && target.isActiveAndEnabled && isTargetInScene
? target.context
: null;
}
}
public override RectTransform transitionRoot => useTargetTransform && isTargetInScene
? target.transitionRoot
: transform as RectTransform;
: m_CustomRoot
? m_CustomRoot
: transform as RectTransform;
private bool isTargetInScene => target && target.gameObject.scene.IsValid();
protected override void OnEnable()
{
RefreshTarget(target);
UIExtraCallbacks.onBeforeCanvasRebuild += SetVerticesDirtyIfTransformChanged;
CheckTransform();
if (!preset)
{
RefreshTarget(target);
}
base.OnEnable();
}
protected override void OnDisable()
{
RefreshTarget(null);
UIExtraCallbacks.onBeforeCanvasRebuild -= SetVerticesDirtyIfTransformChanged;
base.OnDisable();
}
protected override void OnDestroy()
{
_currentTarget = null;
base.OnDestroy();
}
#if UNITY_EDITOR
protected override void OnValidate()
{
RefreshTarget(target);
base.OnValidate();
}
internal override void SetEnablePreviewIfSelected(GameObject[] selection)
{
// Following the instantiated target.
if (isTargetInScene)
{
target.SetEnablePreviewIfSelected(selection);
}
// Following the preset/preset-target.
else if (context != null)
{
context.SetEnablePreview(selection.Contains(gameObject), effectMaterial);
}
}
#endif
private void RefreshTarget(UIEffect newTarget)
@@ -96,22 +175,48 @@ namespace Coffee.UIEffects
_currentTarget.replicas.Remove(this);
}
_currentTarget = newTarget;
if (_currentTarget)
if (newTarget)
{
_currentTarget.replicas.Add(this);
_currentTarget = newTarget;
if (isTargetInScene)
{
_currentTarget.replicas.Add(this);
}
}
else
{
_currentTarget = null;
}
}
protected override void UpdateContext(UIEffectContext c)
internal override void UpdateContext(UIEffectContext dst)
{
// Following the preset.
if (preset)
{
preset.UpdateContext(dst);
}
// Following the preset-target.
else if (target && !isTargetInScene)
{
target.UpdateContext(dst);
}
}
public override void ApplyContextToMaterial(Material material)
{
if (!isActiveAndEnabled || !target || !target.isActiveAndEnabled) return;
if (!isActiveAndEnabled && !preset && !target) return;
base.ApplyContextToMaterial(material);
// Following the preset/preset-target.
if (preset || (target && !isTargetInScene))
{
base.ApplyContextToMaterial(material);
}
// Following the instantiated target.
else if (isTargetInScene && target.isActiveAndEnabled)
{
base.ApplyContextToMaterial(material);
}
}
public override void SetRate(float rate, UIEffectTweener.CullingMask mask)
@@ -120,22 +225,25 @@ namespace Coffee.UIEffects
public override bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera)
{
return !target || target.IsRaycastLocationValid(sp, eventCamera);
if (!isActiveAndEnabled || !isTargetInScene) return true;
return target.IsRaycastLocationValid(sp, eventCamera);
}
private bool CheckTransform()
public void OnBeforeSerialize()
{
return useTargetTransform
&& target
&& transform.HasChanged(target.transform, ref _prevTransformHash,
UIEffectProjectSettings.transformSensitivity);
}
private void SetVerticesDirtyIfTransformChanged()
public void OnAfterDeserialize()
{
if (CheckTransform())
if (m_Preset)
{
SetVerticesDirty();
m_Target = null;
}
else if (m_Target)
{
m_Preset = null;
}
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 5b93acc4527c740459bbfbd3404191be, type: 3}
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+86 -6
View File
@@ -1,14 +1,21 @@
using System;
using Coffee.UIEffectInternal;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Serialization;
namespace Coffee.UIEffects
{
[Icon("Packages/com.coffee.ui-effect/Editor/UIEffectIconIcon.png")]
[ExecuteAlways]
[RequireComponent(typeof(UIEffectBase))]
public class UIEffectTweener : MonoBehaviour
{
[Serializable]
public class TweenerEvent : UnityEvent<float>
{
}
[Flags]
public enum CullingMask
{
@@ -18,7 +25,8 @@ namespace Coffee.UIEffects
Transition = 1 << 3,
GradiationOffset = 1 << 5,
GradiationRotation = 1 << 6,
EdgeShiny = 1 << 8
EdgeShiny = 1 << 8,
Event = 1 << 31
}
public enum UpdateMode
@@ -52,7 +60,9 @@ namespace Coffee.UIEffects
[Tooltip("The culling mask of the tween.")]
[SerializeField]
private CullingMask m_CullingMask = (CullingMask)(-1);
private CullingMask m_CullingMask = CullingMask.Tone | CullingMask.Color | CullingMask.Sampling |
CullingMask.Transition | CullingMask.GradiationOffset |
CullingMask.GradiationRotation | CullingMask.EdgeShiny;
[Tooltip("The direction of the tween.")]
[SerializeField]
@@ -62,6 +72,13 @@ namespace Coffee.UIEffects
[SerializeField]
private AnimationCurve m_Curve = AnimationCurve.Linear(0, 0, 1, 1);
[SerializeField]
private bool m_SeparateReverseCurve;
[Tooltip("The curve to tween the properties.")]
[SerializeField]
private AnimationCurve m_ReverseCurve = AnimationCurve.Linear(0, 0, 1, 1);
[Tooltip("The delay in seconds before the tween starts.")]
[SerializeField]
[Range(0f, 10)]
@@ -105,6 +122,10 @@ namespace Coffee.UIEffects
[SerializeField]
private UnityEvent m_OnComplete = new UnityEvent();
[Tooltip("Event to invoke when the rate was changed.")]
[SerializeField]
private TweenerEvent m_OnChangedRate = new TweenerEvent();
private bool _isPaused;
private float _rate = -1;
private float _time;
@@ -147,8 +168,38 @@ namespace Coffee.UIEffects
_rate = value;
if (!target || cullingMask == 0) return;
var evaluatedRate = m_Curve.Evaluate(_rate);
var currentCurve = curve;
if (separateReverseCurve)
{
switch (wrapMode)
{
case WrapMode.Once:
case WrapMode.Loop:
if (direction == Direction.Reverse)
{
currentCurve = reverseCurve;
}
break;
case WrapMode.PingPongOnce:
case WrapMode.PingPongLoop:
if (delay + duration + interval <= _time)
{
currentCurve = reverseCurve;
}
break;
}
}
var evaluatedRate = currentCurve.Evaluate(_rate);
target.SetRate(evaluatedRate, cullingMask);
if (0 != (cullingMask & CullingMask.Event))
{
onChangedRate.Invoke(evaluatedRate);
}
}
}
@@ -268,11 +319,28 @@ namespace Coffee.UIEffects
set => m_Curve = value;
}
public bool separateReverseCurve
{
get => m_SeparateReverseCurve;
set => m_SeparateReverseCurve = value;
}
public AnimationCurve reverseCurve
{
get => m_ReverseCurve;
set => m_ReverseCurve = value;
}
/// <summary>
/// Event to invoke when the tween has completed.
/// </summary>
public UnityEvent onComplete => m_OnComplete;
/// <summary>
/// Event to invoke when the rate was changed.
/// </summary>
public TweenerEvent onChangedRate => m_OnChangedRate;
/// <summary>
/// Is the tween playing?
/// </summary>
@@ -343,7 +411,7 @@ namespace Coffee.UIEffects
{
if (resetTime)
{
ResetTime();
ResetTime(direction);
}
Play();
@@ -363,7 +431,7 @@ namespace Coffee.UIEffects
{
if (resetTime)
{
ResetTime();
ResetTime(Direction.Forward);
}
PlayForward();
@@ -384,7 +452,7 @@ namespace Coffee.UIEffects
{
if (resetTime)
{
ResetTime();
ResetTime(Direction.Reverse);
}
PlayReverse();
@@ -417,6 +485,18 @@ namespace Coffee.UIEffects
SetTime(0);
}
public void ResetTime(Direction dir)
{
if (dir == Direction.Forward)
{
SetTime(0);
}
else
{
SetTime(totalTime - 0.0001f);
}
}
[Obsolete(
"UIEffectTweener.Restart has been deprecated. Use UIEffectTweener.ResetTime instead (UnityUpgradable) -> ResetTime")]
public void Restart()
+1 -1
View File
@@ -5,7 +5,7 @@ MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 5b93acc4527c740459bbfbd3404191be, type: 3}
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,394 +0,0 @@
using System.Collections.Generic;
using UnityEngine;
namespace Coffee.UIEffects
{
internal static class GradientUtil
{
public static void DoHorizontalGradient(List<UIVertex> verts, Color a, Color b, float offset, float scale,
Rect rect, Matrix4x4 m)
{
for (var i = 0; i < verts.Count; i++)
{
var vt = verts[i];
var x = Mathf.InverseLerp(rect.xMin, rect.xMax, m.MultiplyPoint3x4(vt.position).x);
var t = Mathf.Clamp01(offset + (x - 0.5f) * scale + 0.5f);
vt.color *= Color.Lerp(a, b, t);
verts[i] = vt;
}
}
public static void DoHorizontalGradient(List<UIVertex> verts, Gradient gradient, List<float> splitTimes,
float offset, float scale, Rect rect, Matrix4x4 m)
{
var count = verts.Count;
for (var i = 0; i < verts.Count; i += 6)
{
UIVertexUtil.GetQuad(verts, i, out var lb, out var lt, out var rt, out var rb);
if (i + 5 < count)
{
UIVertexUtil.SplitHorizontalFast(verts, splitTimes, lb, lt, ref rb, ref rt, rect, m);
}
lb.color *= Evaluate(gradient, rect, m.MultiplyPoint3x4(lb.position).x + 0.0005f, offset, scale);
lt.color *= Evaluate(gradient, rect, m.MultiplyPoint3x4(lt.position).x + 0.0005f, offset, scale);
rt.color *= Evaluate(gradient, rect, m.MultiplyPoint3x4(rt.position).x - 0.0005f, offset, scale);
rb.color *= Evaluate(gradient, rect, m.MultiplyPoint3x4(rb.position).x - 0.0005f, offset, scale);
UIVertexUtil.SetQuad(verts, i, lb, lt, rt, rb);
}
return;
static Color Evaluate(Gradient gradient, Rect rect, float t, float offset, float scale)
{
t = Mathf.InverseLerp(rect.xMin, rect.xMax, t); // 0-1
t = Mathf.Repeat((t - offset * scale - (1 - scale) / 2) / scale, 1); // Revert
return gradient.Evaluate(t);
}
}
public static void DoHorizontalGradientFixed(List<UIVertex> verts, Gradient gradient, float offset, float scale,
Rect rect, Matrix4x4 m)
{
var count = verts.Count;
for (var i = 0; i < count; i += 3)
{
var vt0 = verts[i + 0];
var vt1 = verts[i + 1];
var vt2 = verts[i + 2];
var center = m.MultiplyPoint3x4((vt0.position + vt1.position + vt2.position) / 3).x;
vt0.color *= Evaluate(gradient, rect, center, offset, scale);
vt1.color *= Evaluate(gradient, rect, center, offset, scale);
vt2.color *= Evaluate(gradient, rect, center, offset, scale);
verts[i + 0] = vt0;
verts[i + 1] = vt1;
verts[i + 2] = vt2;
}
return;
static Color Evaluate(Gradient gradient, Rect rect, float t, float offset, float scale)
{
t = Mathf.InverseLerp(rect.xMin, rect.xMax, t); // 0-1
t = Mathf.Repeat((t - offset * scale - (1 - scale) / 2) / scale, 1); // Revert
return gradient.Evaluate(t);
}
}
public static void DoHorizontalGradient(List<UIVertex> verts, Gradient gradient, float offset, float scale,
Rect rect, Matrix4x4 m)
{
var count = verts.Count;
for (var i = 0; i < count; i++)
{
var vt = verts[i];
vt.color *= Evaluate(gradient, rect, m.MultiplyPoint3x4(vt.position).x, offset, scale);
verts[i] = vt;
}
return;
static Color Evaluate(Gradient gradient, Rect rect, float t, float offset, float scale)
{
t = Mathf.InverseLerp(rect.xMin, rect.xMax, t); // 0-1
t = Mathf.Repeat((t - offset * scale - (1 - scale) / 2) / scale, 1); // Revert
return gradient.Evaluate(t);
}
}
public static void DoVerticalGradient(List<UIVertex> verts, Color a, Color b, float offset, float scale,
Rect rect, Matrix4x4 m)
{
for (var i = 0; i < verts.Count; i++)
{
var vt = verts[i];
var y = Mathf.InverseLerp(rect.yMin, rect.yMax, m.MultiplyPoint3x4(vt.position).y);
var t = Mathf.Clamp01(offset + (0.5f - y) * scale + 0.5f);
vt.color *= Color.Lerp(a, b, t);
verts[i] = vt;
}
}
public static void DoVerticalGradient(List<UIVertex> verts, Gradient gradient, List<float> splitTimes,
float offset, float scale, Rect rect, Matrix4x4 m)
{
var count = verts.Count;
for (var i = 0; i < verts.Count; i += 6)
{
UIVertexUtil.GetQuad(verts, i, out var lb, out var lt, out var rt, out var rb);
if (i + 5 < count)
{
UIVertexUtil.SplitVerticalFast(verts, splitTimes, lb, ref lt, rb, ref rt, rect, m);
}
lb.color *= Evaluate(gradient, rect, m.MultiplyPoint3x4(lb.position).y + 0.0005f, offset, scale);
lt.color *= Evaluate(gradient, rect, m.MultiplyPoint3x4(lt.position).y - 0.0005f, offset, scale);
rt.color *= Evaluate(gradient, rect, m.MultiplyPoint3x4(rt.position).y - 0.0005f, offset, scale);
rb.color *= Evaluate(gradient, rect, m.MultiplyPoint3x4(rb.position).y + 0.0005f, offset, scale);
UIVertexUtil.SetQuad(verts, i, lb, lt, rt, rb);
}
return;
static Color Evaluate(Gradient gradient, Rect rect, float t, float offset, float scale)
{
t = Mathf.InverseLerp(rect.yMin, rect.yMax, t); // 0-1
t = Mathf.Repeat((t - offset * scale - (1 - scale) / 2) / scale, 1); // Revert
return gradient.Evaluate(t);
}
}
public static void DoVerticalGradient(List<UIVertex> verts, Gradient gradient, float offset, float scale,
Rect rect, Matrix4x4 m)
{
var count = verts.Count;
for (var i = 0; i < count; i++)
{
var vt = verts[i];
vt.color *= Evaluate(gradient, rect, m.MultiplyPoint3x4(vt.position).y, offset, scale);
verts[i] = vt;
}
return;
static Color Evaluate(Gradient gradient, Rect rect, float t, float offset, float scale)
{
t = Mathf.InverseLerp(rect.yMin, rect.yMax, t); // 0-1
t = Mathf.Repeat((t - offset * scale - (1 - scale) / 2) / scale, 1); // Revert
return gradient.Evaluate(t);
}
}
public static void DoDiagonal(List<UIVertex> verts, Color a, Color b, Color c, Color d, float offset,
float scale, Rect rect, Matrix4x4 m)
{
for (var i = 0; i < verts.Count; i++)
{
var vt = verts[i];
var x = Mathf.InverseLerp(rect.xMin, rect.xMax, m.MultiplyPoint3x4(vt.position).x);
var y = Mathf.InverseLerp(rect.yMin, rect.yMax, m.MultiplyPoint3x4(vt.position).y);
var tx = Mathf.Clamp01(offset + (x - 0.5f) * scale + 0.5f);
var ty = Mathf.Clamp01(offset + (0.5f - y) * scale + 0.5f);
vt.color *= Color.Lerp(Color.Lerp(a, b, tx), Color.Lerp(c, d, tx), ty);
verts[i] = vt;
}
}
public static void DoDiagonalGradientToRightBottom(List<UIVertex> verts, Color a, Color b, float offset,
float scale, Rect rect, Matrix4x4 m)
{
for (var i = 0; i < verts.Count; i++)
{
var vt = verts[i];
var x = Mathf.InverseLerp(rect.xMin, rect.xMax, m.MultiplyPoint3x4(vt.position).x);
var y = Mathf.InverseLerp(rect.yMin, rect.yMax, m.MultiplyPoint3x4(vt.position).y);
var t = Mathf.Clamp01(0.5f * scale + 0.5f + offset - (1 - x + y) * scale / 2);
vt.color *= Color.Lerp(a, b, t);
verts[i] = vt;
}
}
public static void DoDiagonalGradientToLeftBottom(List<UIVertex> verts, Color a, Color b, float offset,
float scale, Rect rect, Matrix4x4 m)
{
for (var i = 0; i < verts.Count; i++)
{
var vt = verts[i];
var x = Mathf.InverseLerp(rect.xMin, rect.xMax, m.MultiplyPoint3x4(vt.position).x);
var y = Mathf.InverseLerp(rect.yMin, rect.yMax, m.MultiplyPoint3x4(vt.position).y);
var t = Mathf.Clamp01(0.5f * scale + 0.5f + offset - (x + y) * scale / 2);
vt.color *= Color.Lerp(a, b, t);
verts[i] = vt;
}
}
public static void DoRadialGradient(List<UIVertex> verts, Color a, Color b, float offset, float scale,
Rect rect, Matrix4x4 m, int divide)
{
var count = verts.Count;
for (var i = 0; i < count; i += 6)
{
UIVertexUtil.GetQuad(verts, i, out var lb, out var lt, out var rt, out var rb);
for (var j = 1; j < divide; j++)
{
var min = Mathf.InverseLerp(rect.xMin, rect.xMax, m.MultiplyPoint3x4(lb.position).x);
var max = Mathf.InverseLerp(rect.xMin, rect.xMax, m.MultiplyPoint3x4(rt.position).x);
var time = 1f - (float)j / divide;
if (time <= min || max <= time) continue;
UIVertexUtil.SplitHorizontal(verts, lb, lt, ref rb, ref rt, Mathf.InverseLerp(min, max, time));
}
UIVertexUtil.SetQuad(verts, i, lb, lt, rt, rb);
}
count = verts.Count;
for (var i = 0; i < verts.Count; i += 6)
{
UIVertexUtil.GetQuad(verts, i, out var lb, out var lt, out var rt, out var rb);
if (i + 5 < count)
{
for (var j = 1; j < divide; j++)
{
var min = Mathf.InverseLerp(rect.yMin, rect.yMax, m.MultiplyPoint3x4(lb.position).y);
var max = Mathf.InverseLerp(rect.yMin, rect.yMax, m.MultiplyPoint3x4(rt.position).y);
var time = 1f - (float)j / divide;
if (time <= min || max <= time) continue;
UIVertexUtil.SplitVertical(verts, lb, ref lt, rb, ref rt, Mathf.InverseLerp(min, max, time));
}
}
lb.color *= DoGradient(lb, a, b, rect, m, offset, scale);
lt.color *= DoGradient(lt, a, b, rect, m, offset, scale);
rt.color *= DoGradient(rt, a, b, rect, m, offset, scale);
rb.color *= DoGradient(rb, a, b, rect, m, offset, scale);
UIVertexUtil.SetQuad(verts, i, lb, lt, rt, rb);
}
return;
static Color DoGradient(UIVertex vt, Color a, Color b, Rect rect, Matrix4x4 m, float offset, float scale)
{
var x = Mathf.InverseLerp(rect.xMin, rect.xMax, m.MultiplyPoint3x4(vt.position).x) - 0.5f;
var y = Mathf.InverseLerp(rect.yMin, rect.yMax, m.MultiplyPoint3x4(vt.position).y) - 0.5f;
var t = Mathf.Clamp01(offset + Mathf.Sqrt(x * x + y * y) * 2 * scale);
return Color.Lerp(a, b, t);
}
}
public static void DoAngleGradient(List<UIVertex> verts, Gradient gradient, List<float> splitTimes,
float offset, float scale, Rect rect, Matrix4x4 m)
{
UIVertexUtil.SplitAngle(verts, splitTimes, rect, m);
if (gradient.mode == GradientMode.Fixed)
{
DoHorizontalGradientFixed(verts, gradient, offset, scale, rect, m);
}
else
{
DoHorizontalGradient(verts, gradient, offset, scale, rect, m);
}
}
public static void GetKeyTimes(Gradient gradient, List<float> results)
{
results.Clear();
var colors = gradient.colorKeys;
for (var i = 0; i < colors.Length; i++)
{
AddKeyTime(results, colors[i].time);
}
var alphas = gradient.alphaKeys;
for (var i = 0; i < alphas.Length; i++)
{
AddKeyTime(results, alphas[i].time);
}
AddKeyTime(results, 0);
AddKeyTime(results, 1);
results.Sort((a, b) => b.CompareTo(a));
return;
static void AddKeyTime(List<float> results, float time)
{
if (!Contains(results, time))
{
results.Add(time);
}
}
static bool Contains(List<float> list, float v)
{
for (var i = 0; i < list.Count; i++)
{
if (Mathf.Abs(list[i] - v) < 0.001f) return true;
}
return false;
}
}
public static void SplitKeyTimes(List<float> keyTimes, List<float> results, float offset, float scale)
{
results.Clear();
for (var i = 0; i < keyTimes.Count; i++)
{
AddSplitTime(results, keyTimes[i], offset, scale);
}
results.Sort((a, b) => b.CompareTo(a));
return;
static void AddSplitTime(List<float> results, float time, float offset, float scale)
{
time = time * scale + offset * scale + (1 - scale) / 2;
while (0 < time)
{
time -= scale;
}
while (time <= 1f)
{
if (0 <= time && !Contains(results, time))
{
results.Add(time);
}
time += scale;
}
}
static bool Contains(List<float> list, float v)
{
for (var i = 0; i < list.Count; i++)
{
if (Mathf.Abs(list[i] - v) < 0.001f) return true;
}
return false;
}
}
public static Rect RotateRectAsNormalized(Rect rect, float rot)
{
var rad = -rot * Mathf.Deg2Rad;
var cos = Mathf.Cos(rad);
var sin = Mathf.Sin(rad);
var dir = new Vector2(cos, sin);
var center = rect.center;
if (Mathf.Abs(dir.x) < 0.0001f)
{
rect.width = rect.height;
}
else if (Mathf.Abs(dir.y) < 0.0001f)
{
rect.height = rect.width;
}
else
{
var d0 = GetPointToLineDistance(new Vector2(rect.xMin, rect.yMax), center, dir, out var p0);
var d1 = GetPointToLineDistance(new Vector2(rect.xMin, rect.yMin), center, dir, out var p1);
var closest = d0 < d1 ? p0 : p1;
rect.width = rect.height = Vector2.Distance(center, closest) * 2;
}
rect.center = new Vector2(Vector2.Dot(center, dir), 0);
return rect;
}
private static float GetPointToLineDistance(Vector2 point, Vector2 origin, Vector2 dir, out Vector2 closest)
{
var dirNormalized = dir.normalized;
var time = Vector2.Dot(point - origin, dirNormalized);
closest = origin + time * dirNormalized;
return Vector2.Distance(point, closest);
}
}
}
+10 -8
View File
@@ -72,22 +72,24 @@ namespace Coffee.UIEffects
{
}
public virtual Vector4 ModifyExpandSize(Graphic graphic, Vector4 expandSize)
{
return expandSize;
}
private static readonly Func<UIVertex, UIVertex, UIVertex, float, UIVertex> s_OnLerpVertex =
null;
private static readonly Func<UIVertex, UIVertex> s_OnMarkAsShadow =
vt =>
private static readonly Func<UIVertex, float, UIVertex> s_OnMarkAsShadow =
(vt, s) =>
{
vt.uv0.z -= 8;
vt.uv0.w -= 8;
vt.uv1.x -= s;
return vt;
};
private static readonly Func<UIVertex, Rect, float, float, UIVertex> s_OnModifyVertex =
(vt, uvMask, normalizedX, normalizedY) =>
private static readonly Func<UIVertex, Rect, UIVertex> s_OnModifyVertex =
(vt, uvMask) =>
{
vt.uv0.z = normalizedX;
vt.uv0.w = normalizedY;
vt.uv1 = new Vector4(uvMask.xMin, uvMask.yMin, uvMask.xMax, uvMask.yMax);
return vt;
};
@@ -0,0 +1,54 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIEffects
{
internal class ImageProxy : GraphicProxy
{
#if UNITY_EDITOR
[InitializeOnLoadMethod]
#endif
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void InitializeOnLoad()
{
Register(new ImageProxy());
}
/// <summary>
/// Check if the graphic is valid for this proxy.
/// </summary>
protected override bool IsValid(Graphic graphic)
{
if (!graphic) return false;
if (graphic is Image) return true;
return false;
}
/// <summary>
/// Check if the graphic is a text.
/// </summary>
public override bool IsText(Graphic graphic)
{
return false;
}
public override Vector4 ModifyExpandSize(Graphic graphic, Vector4 expandSize)
{
if (graphic is Image image
&& image.type == Image.Type.Filled
&& image.fillMethod == Image.FillMethod.Radial360
&& image.fillAmount <= 0.5f)
{
expandSize[(image.fillOrigin + (image.fillClockwise ? 2 : 0)) % 4] = 0;
if (image.fillAmount <= 0.25f)
{
expandSize[(image.fillOrigin + 3) % 4] = 0;
}
}
return expandSize;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cddfadaf298c14befb49972983c16f2d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+11 -9
View File
@@ -6,7 +6,7 @@ namespace Coffee.UIEffects
{
public static class ShadowUtil
{
public static Func<UIVertex, UIVertex> onMarkAsShadow;
public static Func<UIVertex, float, UIVertex> onMarkAsShadow;
public static void DoShadow(List<UIVertex> verts, Vector2[] vectors, Vector2 distance, int iteration,
float fade)
@@ -30,14 +30,7 @@ namespace Coffee.UIEffects
{
if (onMarkAsShadow != null)
{
verts[i] = onMarkAsShadow(verts[i]);
}
else
{
var vt = verts[i];
vt.uv0.z -= 8;
vt.uv0.w -= 8;
verts[i] = vt;
verts[i] = onMarkAsShadow(verts[i], 2);
}
}
}
@@ -54,6 +47,15 @@ namespace Coffee.UIEffects
var offset = distance.y - (scale + 1) * pivot * height;
var range = new Vector2(rect2.yMin, rect2.yMax);
ApplyMirror(verts, count, rate, range, scale, offset, fade);
// Mark as shadow vertices.
for (var i = 0; i < verts.Count - count; i++)
{
if (onMarkAsShadow != null)
{
verts[i] = onMarkAsShadow(verts[i], 4);
}
}
}
private static void ApplyMirror(List<UIVertex> verts, int count, float rate, Vector2 range, float scale,
+44 -26
View File
@@ -91,19 +91,16 @@ namespace Coffee.UIEffects
};
#endif
private static readonly Func<UIVertex, UIVertex> s_OnMarkAsShadow =
vt =>
private static readonly Func<UIVertex, float, UIVertex> s_OnMarkAsShadow =
(vt, s) =>
{
vt.uv1.z -= 8;
vt.uv1.w -= 8;
vt.uv2.x -= s;
return vt;
};
private static readonly Func<UIVertex, Rect, float, float, UIVertex> s_OnModifyVertex =
(vt, uvMask, normalizedX, normalizedY) =>
private static readonly Func<UIVertex, Rect, UIVertex> s_OnModifyVertex =
(vt, uvMask) =>
{
vt.uv1.z = normalizedX;
vt.uv1.w = normalizedY;
vt.uv2 = new Vector4(uvMask.xMin, uvMask.yMin, uvMask.xMax, uvMask.yMax);
return vt;
};
@@ -128,7 +125,7 @@ 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)
if (obj is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
{
s_ChangedInstances.Add(textMeshProUGUI);
}
@@ -189,11 +186,14 @@ namespace Coffee.UIEffects
foreach (var textMeshProUGUI in s_RegisteredInstances)
{
if (!textMeshProUGUI || !textMeshProUGUI.isActiveAndEnabled) continue;
if (textMeshProUGUI.TryGetComponent<UIEffect>(out var effect) && effect.isActiveAndEnabled)
if (textMeshProUGUI.TryGetComponent<UIEffectBase>(out var effect) && effect.isActiveAndEnabled)
{
effect.ReleaseMaterial();
effect.SetMaterialDirty();
}
}
Misc.QueuePlayerLoopUpdate();
};
#endif
}
@@ -208,25 +208,20 @@ namespace Coffee.UIEffects
private static void ModifyMesh(TextMeshProUGUI textMeshProUGUI)
{
if (!textMeshProUGUI.TryGetComponent<UIEffectBase>(out var effect)) return;
if (!effect || !effect.isActiveAndEnabled) return;
s_RegisteredInstances.Add(textMeshProUGUI);
if (!s_Mesh)
{
s_Mesh = new Mesh();
s_Mesh.MarkDynamic();
}
var target = effect is UIEffect uiEffect
? uiEffect
: effect is UIEffectReplica parentReplica
? parentReplica.target
: null;
s_RegisteredInstances.Add(textMeshProUGUI);
var effect = textMeshProUGUI.GetComponent<UIEffectBase>();
var subMeshes = InternalListPool<TMP_SubMeshUI>.Rent();
var modifiers = InternalListPool<IMeshModifier>.Rent();
var subModifiers = InternalListPool<IMeshModifier>.Rent();
textMeshProUGUI.GetComponentsInChildren(subMeshes, 1);
textMeshProUGUI.GetComponents(modifiers);
for (var i = 0; i < textMeshProUGUI.textInfo.meshInfo.Length; i++)
{
var meshInfo = textMeshProUGUI.textInfo.meshInfo[i];
@@ -234,7 +229,6 @@ namespace Coffee.UIEffects
meshInfo.mesh.CopyTo(s_VertexHelper, meshInfo.vertexCount, meshInfo.vertexCount * 6 / 4);
if (i == 0)
{
textMeshProUGUI.GetComponents(modifiers);
foreach (var modifier in modifiers)
{
modifier.ModifyMesh(s_VertexHelper);
@@ -245,14 +239,37 @@ namespace Coffee.UIEffects
}
else if (i - 1 < subMeshes.Count)
{
foreach (var modifier in modifiers)
{
if (modifier is UIEffectBase) continue;
modifier.ModifyMesh(s_VertexHelper);
}
var subMeshUI = GetSubMeshUI(subMeshes, meshInfo.material, i - 1);
if (!target || !subMeshUI) break;
if (!subMeshUI) break;
var replica = subMeshUI.GetOrAddComponent<UIEffectReplica>();
replica.target = target;
if (effect is UIEffect pEffect && pEffect.isActiveAndEnabled)
{
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;
}
subMeshUI.GetComponents(modifiers);
foreach (var modifier in modifiers)
subMeshUI.GetComponents(subModifiers);
foreach (var modifier in subModifiers)
{
modifier.ModifyMesh(s_VertexHelper);
}
@@ -266,8 +283,9 @@ namespace Coffee.UIEffects
}
}
InternalListPool<IMeshModifier>.Return(ref modifiers);
InternalListPool<TMP_SubMeshUI>.Return(ref subMeshes);
InternalListPool<IMeshModifier>.Return(ref modifiers);
InternalListPool<IMeshModifier>.Return(ref subModifiers);
s_Mesh.Clear(false);
}
+67 -206
View File
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using Coffee.UIEffectInternal;
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIEffects
{
@@ -9,6 +9,31 @@ namespace Coffee.UIEffects
{
public static Func<UIVertex, UIVertex, UIVertex, float, UIVertex> onLerpVertex;
public static void Flip(List<UIVertex> verts, bool horizontal, bool vertical)
{
var count = verts.Count;
for (var i = 0; i < count; i++)
{
var vt = verts[i];
var pos = vt.position;
vt.position = new Vector3(horizontal ? -pos.x : pos.x, vertical ? -pos.y : pos.y);
verts[i] = vt;
}
}
public static void Flip(VertexHelper vh, bool horizontal, bool vertical)
{
var count = vh.currentVertCount;
var vt = default(UIVertex);
for (var i = 0; i < count; i++)
{
vh.PopulateUIVertex(ref vt, i);
var pos = vt.position;
vt.position = new Vector3(horizontal ? -pos.x : pos.x, vertical ? -pos.y : pos.y);
vh.SetUIVertex(vt, i);
}
}
public static void ExpandCapacity(List<UIVertex> verts, int multiplier)
{
var capacity = Mathf.NextPowerOfTwo(verts.Count * multiplier);
@@ -18,56 +43,62 @@ namespace Coffee.UIEffects
}
}
public static void Expand(List<UIVertex> verts, int start, int bundleSize, Vector2 expandSize, Rect bounds)
public static void Expand(List<UIVertex> verts, int start, int bundleSize, Vector4 expandSize, Rect bounds)
{
if (expandSize == Vector2.zero) return;
if (expandSize == Vector4.zero) return;
// Quad (6 vertices)
for (var j = 0; j < bundleSize; j += 6)
for (var j = 0; j < bundleSize; j += 3)
{
var size = default(Vector3);
var extendPos = default(Vector3);
var extendUV = default(Vector3);
var posLB = verts[start + j + 1].position;
var posRT = verts[start + j + 4].position;
var willExpand = bundleSize == 6 // Text or simple quad
|| !bounds.Contains(posLB)
|| !bounds.Contains(posRT); // Outer 9-sliced quad
if (willExpand)
if (bounds.Contains(verts[start + j + 0].position)
&& bounds.Contains(verts[start + j + 1].position)
&& bounds.Contains(verts[start + j + 2].position))
{
var uvLB = verts[start + j + 1].uv0;
var uvRT = verts[start + j + 4].uv0;
var posCenter = (posLB + posRT) / 2;
var uvCenter = (uvLB + uvRT) / 2;
size = posLB - posRT;
size.x = 1 + expandSize.x / Mathf.Abs(size.x);
size.y = 1 + expandSize.y / Mathf.Abs(size.y);
size.z = 1;
extendPos = posCenter - Vector3.Scale(size, posCenter);
extendUV = uvCenter - Vector4.Scale(size, uvCenter);
continue;
}
GetBounds(verts, start + j, 3, out var posBounds, out var uvBounds);
var posCenter = (Vector4)posBounds.center;
posCenter.z = posCenter.x;
posCenter.w = posCenter.y;
var uvCenter = (Vector4)uvBounds.center;
uvCenter.z = uvCenter.x;
uvCenter.w = uvCenter.y;
var size = (Vector4)posBounds.size;
size.z = 1 + expandSize.z / Mathf.Abs(size.x);
size.w = 1 + expandSize.w / Mathf.Abs(size.y);
size.x = 1 + expandSize.x / Mathf.Abs(size.x);
size.y = 1 + expandSize.y / Mathf.Abs(size.y);
var extendPos = posCenter - Vector4.Scale(size, posCenter);
var extendUV = uvCenter - Vector4.Scale(size, uvCenter);
// Set vertex position, uv, uvMask and local normalized position.
for (var k = 0; k < 6; k++)
for (var k = 0; k < 3; k++)
{
var vt = verts[start + j + k];
var pos = vt.position;
var uv0 = vt.uv0;
// Expand edge vertex
if (willExpand)
if (pos.x < bounds.xMin)
{
if (pos.x < bounds.xMin || bounds.xMax < pos.x)
{
pos.x = pos.x * size.x + extendPos.x;
uv0.x = uv0.x * size.x + extendUV.x;
}
pos.x = pos.x * size.x + extendPos.x;
uv0.x = uv0.x * size.x + extendUV.x;
}
else if (bounds.xMax < pos.x)
{
pos.x = pos.x * size.z + extendPos.z;
uv0.x = uv0.x * size.z + extendUV.z;
}
if (pos.y < bounds.yMin || bounds.yMax < pos.y)
{
pos.y = pos.y * size.y + extendPos.y;
uv0.y = uv0.y * size.y + extendUV.y;
}
if (pos.y < bounds.yMin)
{
pos.y = pos.y * size.y + extendPos.y;
uv0.y = uv0.y * size.y + extendUV.y;
}
else if (bounds.yMax < pos.y)
{
pos.y = pos.y * size.w + extendPos.w;
uv0.y = uv0.y * size.w + extendUV.w;
}
vt.position = pos;
@@ -128,175 +159,5 @@ namespace Coffee.UIEffects
if (max.y < value.y) max.y = value.y; // Top
}
}
public static void GetQuad(List<UIVertex> verts, int i, out UIVertex lb, out UIVertex lt, out UIVertex rt,
out UIVertex rb)
{
lb = verts[i];
lt = verts[i + 1];
rt = verts[i + 2];
rb = verts[i + 4];
}
public static void SetQuad(List<UIVertex> verts, int i, UIVertex lb, UIVertex lt, UIVertex rt, UIVertex rb)
{
verts[i] = verts[i + 5] = lb;
verts[i + 1] = lt;
verts[i + 2] = verts[i + 3] = rt;
verts[i + 4] = rb;
}
public static void SplitHorizontalFast(List<UIVertex> verts, List<float> times, UIVertex lb, UIVertex lt,
ref UIVertex rb, ref UIVertex rt, Rect rect, Matrix4x4 m)
{
if (times == null || times.Count == 0) return;
var min = Mathf.InverseLerp(rect.xMin, rect.xMax, m.MultiplyPoint3x4(lb.position).x);
for (var i = 0; i < times.Count; i++)
{
var time = times[i];
if (time <= 0 || 1 <= time) continue;
var max = Mathf.InverseLerp(rect.xMin, rect.xMax, m.MultiplyPoint3x4(rt.position).x);
if (time <= min || max <= time) continue;
SplitHorizontal(verts, lb, lt, ref rb, ref rt, Mathf.InverseLerp(min, max, time));
}
}
public static void SplitHorizontal(List<UIVertex> verts, UIVertex lb, UIVertex lt, ref UIVertex rb,
ref UIVertex rt, float time)
{
var mb = VertexLerp(lb, rb, time);
var mt = VertexLerp(lt, rt, time);
verts.Add(mb);
verts.Add(mt);
verts.Add(rt);
verts.Add(rt);
verts.Add(rb);
verts.Add(mb);
rt = mt;
rb = mb;
}
public static void SplitVerticalFast(List<UIVertex> verts, List<float> times, UIVertex lb, ref UIVertex lt,
UIVertex rb, ref UIVertex rt, Rect rect, Matrix4x4 m)
{
if (times == null || times.Count == 0) return;
var min = Mathf.InverseLerp(rect.yMin, rect.yMax, m.MultiplyPoint3x4(lb.position).y);
for (var i = 0; i < times.Count; i++)
{
var time = times[i];
var max = Mathf.InverseLerp(rect.yMin, rect.yMax, m.MultiplyPoint3x4(rt.position).y);
if (time <= min || max <= time) continue;
SplitVertical(verts, lb, ref lt, rb, ref rt, Mathf.InverseLerp(min, max, time));
}
}
public static void SplitVertical(List<UIVertex> verts, UIVertex lb, ref UIVertex lt, UIVertex rb,
ref UIVertex rt, float time)
{
var lm = VertexLerp(lb, lt, time);
var rm = VertexLerp(rb, rt, time);
verts.Add(lm);
verts.Add(lt);
verts.Add(rt);
verts.Add(rt);
verts.Add(rm);
verts.Add(lm);
lt = lm;
rt = rm;
}
public static void SplitAngle(List<UIVertex> verts, List<float> times, Rect rect, Matrix4x4 m)
{
if (times == null || times.Count == 0) return;
for (var i = 0; i < times.Count; i++)
{
var x = Mathf.Lerp(rect.xMin, rect.xMax, times[i]);
Split(verts, new Vector2(x, 0), new Vector2(0, 1), m);
}
return;
static void Split(List<UIVertex> verts, Vector2 p, Vector2 dir, Matrix4x4 m)
{
// Each triangle
var intersections = InternalListPool<UIVertex>.Rent();
var count = verts.Count;
for (var i = 0; i < count; i += 3)
{
intersections.Clear();
var n = -1;
// Each edge
for (var j = 0; j < 3; j++)
{
var start = verts[i + j];
var end = verts[i + (j + 1) % 3];
if (DoesIntersect(start, end, p, dir, m, out var intersection))
{
intersections.Add(intersection);
}
else
{
n = j;
}
}
if (intersections.Count == 2)
{
var vt0 = verts[i + (n + 2) % 3];
var vt1 = verts[i + (n + 0) % 3];
var vt2 = verts[i + (n + 1) % 3];
var it0 = intersections[0];
var it1 = intersections[1];
var it2 = intersections[(n + 1) % 2];
verts[i + 0] = vt0;
verts[i + 1] = it0;
verts[i + 2] = it1;
verts.Add(it2);
verts.Add(vt1);
verts.Add(vt2);
verts.Add(vt2);
verts.Add(it0);
verts.Add(it1);
}
}
InternalListPool<UIVertex>.Return(ref intersections);
}
static bool DoesIntersect(UIVertex start, UIVertex end, Vector2 p, Vector2 dir, Matrix4x4 m,
out UIVertex intersection)
{
intersection = default;
var startPosition = (Vector2)m.MultiplyPoint3x4(start.position);
var endPosition = (Vector2)m.MultiplyPoint3x4(end.position);
var segDir = endPosition - startPosition;
var cross = Vector3.Cross(segDir, dir);
// Parallel.
if (cross.magnitude < Mathf.Epsilon)
{
return false; // 線と線分が平行
}
var diff = p - startPosition;
var determinant = Vector3.Dot(cross, cross);
var t = Vector3.Dot(Vector3.Cross(diff, dir), cross) / determinant;
if (0 <= t && t <= 1)
{
intersection = VertexLerp(start, end, t);
return true;
}
return false;
}
}
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 38bc56dae9c524546aba0a50b4e970af
guid: c679ad076c9fb4c5193ee414faf2a60e
folderAsset: yes
DefaultImporter:
externalObjects: {}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9379b7b2236ab4c0e9f8d9f7db9936a8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

@@ -0,0 +1,159 @@
fileFormatVersion: 2
guid: dee1cb6c2ee294c6087ea9d89d368417
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 31, y: 31, z: 31, w: 31}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
cookieLightType: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 4
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 4
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 4
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 4
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 2775f4bfe28684615aa97cccf30fd220
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 147 KiB

Some files were not shown because too many files have changed in this diff Show More