Compare commits

...

120 Commits

Author SHA1 Message Date
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
semantic-release-bot 8155f94943 chore(release): 5.5.1 [skip ci]
## [5.5.1](https://github.com/mob-sakai/UIEffect/compare/5.5.0...5.5.1) (2025-02-14)

### Bug Fixes

* fix v4 compatible components ([6f6a8c9](https://github.com/mob-sakai/UIEffect/commit/6f6a8c95f878a290b1c4238cd0519f14febc04b6))
* fully visible when the transition rate is set to 1 ([0a99bb7](https://github.com/mob-sakai/UIEffect/commit/0a99bb7765443a84070e19c9ea0096808442932e)), closes [#309](https://github.com/mob-sakai/UIEffect/issues/309)
* UIEffect with TextMeshPro appears black in the editor when saving scene ([8cbcd76](https://github.com/mob-sakai/UIEffect/commit/8cbcd765ed9e11c38e3257191c2fc7dcd2c9916e))
2025-02-14 08:01:21 +00:00
mob-sakai 0a99bb7765 fix: fully visible when the transition rate is set to 1
close #309
2025-02-14 15:56:10 +09:00
mob-sakai 6b6ff3e1d8 chore: update demo 2025-02-14 15:56:10 +09:00
mob-sakai 8cbcd765ed fix: UIEffect with TextMeshPro appears black in the editor when saving scene 2025-02-14 15:56:10 +09:00
mob-sakai 6f6a8c95f8 fix: fix v4 compatible components 2025-02-14 15:56:10 +09:00
semantic-release-bot fbc697ce85 chore(release): 5.5.0 [skip ci]
# [5.5.0](https://github.com/mob-sakai/UIEffect/compare/5.4.0...5.5.0) (2025-02-12)

### Features

* add `GradationMode.Diagonal` with 4 colors ([b72a1c0](https://github.com/mob-sakai/UIEffect/commit/b72a1c05c6d1d7b3c0aa11582d4a97da80d7fce9)), closes [#308](https://github.com/mob-sakai/UIEffect/issues/308)
* add built-in presets ([8930b56](https://github.com/mob-sakai/UIEffect/commit/8930b563cb580463e2265483ccd3a42cb84e644b))
2025-02-12 10:25:05 +00:00
mob-sakai 9f8f9f3e7a chore: add demo 2025-02-12 19:11:34 +09:00
mob-sakai 8930b563cb feat: add built-in presets 2025-02-12 12:39:23 +09:00
mob-sakai b72a1c05c6 feat: add GradationMode.Diagonal with 4 colors
close #308
2025-02-12 11:30:13 +09:00
semantic-release-bot fc09152b93 chore(release): 5.4.0 [skip ci]
# [5.4.0](https://github.com/mob-sakai/UIEffect/compare/5.3.4...5.4.0) (2025-02-10)

### Bug Fixes

* gradient color is not updated when calling the `SetGradientKeys` method ([a959fdd](https://github.com/mob-sakai/UIEffect/commit/a959fddd34a93dd0846369938b1cb6be514eee2d))

### Features

* tweener supports `EdgeMode.Shiny` ([32558d4](https://github.com/mob-sakai/UIEffect/commit/32558d4481de31ed9020c82861dc2a2d8ca7d53c)), closes [#307](https://github.com/mob-sakai/UIEffect/issues/307)
2025-02-10 12:19:15 +00:00
mob-sakai fa9c53a0d0 chore: add demo 2025-02-10 20:25:46 +09:00
mob-sakai a959fddd34 fix: gradient color is not updated when calling the SetGradientKeys method 2025-02-10 20:25:46 +09:00
mob-sakai 32558d4481 feat: tweener supports EdgeMode.Shiny
close #307
2025-02-10 20:25:46 +09:00
semantic-release-bot bbb1f965fd chore(release): 5.3.4 [skip ci]
## [5.3.4](https://github.com/mob-sakai/UIEffect/compare/5.3.3...5.3.4) (2025-02-10)

### Bug Fixes

* UIEffect v5.3.3 with TextMeshPro is not working in play mode in editor ([365c43e](https://github.com/mob-sakai/UIEffect/commit/365c43e21dcaaff349cf1362f9bd25b7deb163f7)), closes [#306](https://github.com/mob-sakai/UIEffect/issues/306)
2025-02-10 06:29:40 +00:00
mob-sakai b778d02131 chore: update test workflow 2025-02-10 14:49:34 +09:00
mob-sakai 365c43e21d fix: UIEffect v5.3.3 with TextMeshPro is not working in play mode in editor
close #306
2025-02-10 14:38:43 +09:00
semantic-release-bot 31b16329bc chore(release): 5.3.3 [skip ci]
## [5.3.3](https://github.com/mob-sakai/UIEffect/compare/5.3.2...5.3.3) (2025-02-06)

### Bug Fixes

* when modifying TextMeshPro vertices, element disapear ([7529a7c](https://github.com/mob-sakai/UIEffect/commit/7529a7c4cd8db27a6d3312bce0a6ed6b13e40f35)), closes [#305](https://github.com/mob-sakai/UIEffect/issues/305)
2025-02-06 10:47:39 +00:00
mob-sakai 7529a7c4cd fix: when modifying TextMeshPro vertices, element disapear
close #305
2025-02-06 19:30:01 +09:00
semantic-release-bot c51b5f34bb chore(release): 5.3.2 [skip ci]
## [5.3.2](https://github.com/mob-sakai/UIEffect/compare/5.3.1...5.3.2) (2025-02-04)

### Bug Fixes

* some effects are not working correctly for TextMeshProUGUI in Unity 6 ([63de374](https://github.com/mob-sakai/UIEffect/commit/63de3742ecd7fcdcaa8dcca8dc104c7288291211))
2025-02-04 00:20:28 +00:00
mob-sakai 63de3742ec fix: some effects are not working correctly for TextMeshProUGUI in Unity 6 2025-02-04 09:07:14 +09:00
mob-sakai e9b32e14fd docs: update readme 2025-01-27 15:32:16 +09:00
semantic-release-bot f4ea151244 chore(release): 5.3.1 [skip ci]
## [5.3.1](https://github.com/mob-sakai/UIEffect/compare/5.3.0...5.3.1) (2025-01-27)

### Bug Fixes

* shader keywords for UIEfect are not recognized in Unity 6 ([fd39abf](https://github.com/mob-sakai/UIEffect/commit/fd39abf5a71138919f8feee587576ba187075304)), closes [#301](https://github.com/mob-sakai/UIEffect/issues/301)
2025-01-27 05:03:16 +00:00
mob-sakai fd39abf5a7 fix: shader keywords for UIEfect are not recognized in Unity 6
It seems that `shader_feature_local_fragment needs` to be defined in the shader itself rather than in the cginc file to properly recognize the keywords.
close #301
2025-01-27 14:02:42 +09:00
semantic-release-bot 27a04ca294 chore(release): 5.3.0 [skip ci]
# [5.3.0](https://github.com/mob-sakai/UIEffect/compare/5.2.4...5.3.0) (2025-01-26)

### Features

* `SamplingFilter.EdgeAlpha` and `SamplingFilter.EdgeLuminance` now support the `Sampling Width` property for edge width ([33b1177](https://github.com/mob-sakai/UIEffect/commit/33b1177815b935a887c5a8918748cbeafec32b6b))
* add `EdgeMode` feature ([eadb477](https://github.com/mob-sakai/UIEffect/commit/eadb477bcd91f8909bfa7b8976241411363ee12c))
* add `ResetOnEnable` option for `UIEffectTweener` ([e326bb7](https://github.com/mob-sakai/UIEffect/commit/e326bb77537b921df775646142105a490ae54851)), closes [#299](https://github.com/mob-sakai/UIEffect/issues/299)
* add `TransitionAutoSpeed` property ([7a765c3](https://github.com/mob-sakai/UIEffect/commit/7a765c32d87f6dfbdb990d5b3a272dd80696b374))
* add `TransitionFilter.Pattern` feature ([b57e98b](https://github.com/mob-sakai/UIEffect/commit/b57e98b64c61a7c7eb3ca97f3bd7e909956ee469))
2025-01-26 16:44:32 +00:00
mob-sakai 8edf1f1128 docs: update readme 2025-01-27 01:18:59 +09:00
mob-sakai c5dfc3bd35 demo: add demos 2025-01-27 01:15:43 +09:00
mob-sakai 372519d01f chore: update coffee.internal 2025-01-27 01:15:43 +09:00
mob-sakai 6be2ab7a4f refactor editor 2025-01-27 01:15:43 +09:00
mob-sakai e326bb7753 feat: add ResetOnEnable option for UIEffectTweener
#299
2025-01-27 01:15:43 +09:00
mob-sakai 7a765c32d8 feat: add TransitionAutoSpeed property
You can use this property to loop the TransitionRate without tweener or animation.
2025-01-27 01:15:43 +09:00
mob-sakai b57e98b64c feat: add TransitionFilter.Pattern feature 2025-01-27 01:15:43 +09:00
mob-sakai eadb477bcd feat: add EdgeMode feature 2025-01-27 01:15:43 +09:00
mob-sakai 33b1177815 feat: SamplingFilter.EdgeAlpha and SamplingFilter.EdgeLuminance now support the Sampling Width property for edge width 2025-01-27 01:15:43 +09:00
mob-sakai 792db85b79 refactor: move shader_feature keywords to cginc 2025-01-27 01:15:43 +09:00
semantic-release-bot 889c7ff578 chore(release): 5.2.4 [skip ci]
## [5.2.4](https://github.com/mob-sakai/UIEffect/compare/5.2.3...5.2.4) (2025-01-26)

### Bug Fixes

* properties may not update correctly when changed via code or animation ([5994f88](https://github.com/mob-sakai/UIEffect/commit/5994f8875ed2280e5c863c30f9c7900d4dce70ed)), closes [#300](https://github.com/mob-sakai/UIEffect/issues/300)
2025-01-26 16:04:15 +00:00
mob-sakai 5994f8875e fix: properties may not update correctly when changed via code or animation
close #300
2025-01-25 19:30:01 +09:00
semantic-release-bot b2d70af9c3 chore(release): 5.2.3 [skip ci]
## [5.2.3](https://github.com/mob-sakai/UIEffect/compare/5.2.2...5.2.3) (2025-01-23)

### Bug Fixes

* `SamplingFilter.None` now correctly respects the sampling scale setting ([bc1578b](https://github.com/mob-sakai/UIEffect/commit/bc1578b0ca91b830b976bf200d387d0ac6963ae6))
* fix the shadow mode inspector in editor ([da53585](https://github.com/mob-sakai/UIEffect/commit/da535854ccbeeb98b2556423425d39058bd5f479))
* UIEffect may not work correctly when using `FallbackAtlas` with TextMeshProUGUI ([d3779f9](https://github.com/mob-sakai/UIEffect/commit/d3779f9f57d0410fa4526527ebed30885bfbc2dd)), closes [#298](https://github.com/mob-sakai/UIEffect/issues/298)
2025-01-23 10:17:55 +00:00
mob-sakai da535854cc fix: fix the shadow mode inspector in editor 2025-01-23 16:29:10 +09:00
mob-sakai bc1578b0ca fix: SamplingFilter.None now correctly respects the sampling scale setting 2025-01-23 16:29:10 +09:00
mob-sakai d3779f9f57 fix: UIEffect may not work correctly when using FallbackAtlas with TextMeshProUGUI
close #298
2025-01-23 16:13:10 +09:00
semantic-release-bot 213daa85e9 chore(release): 5.2.2 [skip ci]
## [5.2.2](https://github.com/mob-sakai/UIEffect/compare/5.2.1...5.2.2) (2025-01-18)

### Bug Fixes

* in Unity 6, `Shadow Color` has no effect on TextMeshPro ([6e4d4ab](https://github.com/mob-sakai/UIEffect/commit/6e4d4ab03db786e4c28d0f2c57d9e58655c5d029)), closes [#297](https://github.com/mob-sakai/UIEffect/issues/297)
2025-01-18 08:24:10 +00:00
mob-sakai 6e4d4ab03d fix: in Unity 6, Shadow Color has no effect on TextMeshPro
Import `TextMeshPro Support` again.
close #297
2025-01-18 17:00:56 +09:00
semantic-release-bot 4222d72318 chore(release): 5.2.1 [skip ci]
## [5.2.1](https://github.com/mob-sakai/UIEffect/compare/5.2.0...5.2.1) (2025-01-14)

### Bug Fixes

* shadow color being transparent at maximum `Shadow Fade` ([1d849e5](https://github.com/mob-sakai/UIEffect/commit/1d849e54cb57218a67afc2f8ad36d345bfdd0f74)), closes [#296](https://github.com/mob-sakai/UIEffect/issues/296)
* TextMeshPro is not displayed in prefab mode ([2b44837](https://github.com/mob-sakai/UIEffect/commit/2b44837bb9c93e1cc817a2c1cd112b244cd09391)), closes [#295](https://github.com/mob-sakai/UIEffect/issues/295)
* TextMeshProUGUI disappears when the Y-axis scale is changed ([8159c09](https://github.com/mob-sakai/UIEffect/commit/8159c091e8a6805a7781046ae0f660a3be13862c)), closes [#295](https://github.com/mob-sakai/UIEffect/issues/295)
2025-01-14 11:46:54 +00:00
mob-sakai 8159c091e8 fix: TextMeshProUGUI disappears when the Y-axis scale is changed
close #295
2025-01-14 20:05:01 +09:00
mob-sakai 2b44837bb9 fix: TextMeshPro is not displayed in prefab mode
close #295
2025-01-14 19:58:26 +09:00
mob-sakai 1d849e54cb fix: shadow color being transparent at maximum Shadow Fade
close #296
2025-01-14 19:42:46 +09:00
semantic-release-bot 811f5762e6 chore(release): 5.2.0 [skip ci]
# [5.2.0](https://github.com/mob-sakai/UIEffect/compare/5.1.0...5.2.0) (2025-01-07)

### Bug Fixes

* `Gradation` properties do not update when a preset is loaded ([edf6943](https://github.com/mob-sakai/UIEffect/commit/edf694313f101b66f760bca64593fb87037dcb3d)), closes [#291](https://github.com/mob-sakai/UIEffect/issues/291)
* an error occurs when saving a preset ([894c561](https://github.com/mob-sakai/UIEffect/commit/894c5610d044f211067037b6c69f9860ac496ffc)), closes [#293](https://github.com/mob-sakai/UIEffect/issues/293)
* fix gradation gradient edge (angle gradient) ([0ef6027](https://github.com/mob-sakai/UIEffect/commit/0ef60273714c7b68131f2f0d233b16335a5cd367))

### Features

* `Angle Gradient` gradation supports fixed mode gradient ([7cb8325](https://github.com/mob-sakai/UIEffect/commit/7cb8325e445350d2175865f736186f719e1cbe00))
* `Angle Gradient` gradation supports RectTransform pivot ([2f63adf](https://github.com/mob-sakai/UIEffect/commit/2f63adfba057bec7f8183a5b34654cdf84163a34))
* add `Use HDR Color Picker` option for project settings (editor) ([1be0cd4](https://github.com/mob-sakai/UIEffect/commit/1be0cd45db952d05e51d508c58f65a6541df9de0)), closes [#290](https://github.com/mob-sakai/UIEffect/issues/290)
* the `Allow To Modify Mesh Shape` property should remain unchanged when loading a preset ([f7175c0](https://github.com/mob-sakai/UIEffect/commit/f7175c037371278eb7a0c7883cffccb5c31dba0a)), closes [#294](https://github.com/mob-sakai/UIEffect/issues/294)
* the `Sampling Scale` property should remain unchanged when loading a preset ([238a17d](https://github.com/mob-sakai/UIEffect/commit/238a17d57ddf1f6b859ce830e80a1be6c3d739f1)), closes [#292](https://github.com/mob-sakai/UIEffect/issues/292)
2025-01-07 19:36:25 +00:00
mob-sakai 2f63adfba0 feat: Angle Gradient gradation supports RectTransform pivot 2025-01-08 04:26:07 +09:00
mob-sakai 7cb8325e44 feat: Angle Gradient gradation supports fixed mode gradient 2025-01-08 04:26:07 +09:00
mob-sakai eafb9ce365 test: add reflection test for internal API 2025-01-08 04:26:07 +09:00
mob-sakai 0ef6027371 fix: fix gradation gradient edge (angle gradient) 2025-01-08 04:26:07 +09:00
mob-sakai 92f9611a39 docs: update readme 2025-01-08 04:26:07 +09:00
mob-sakai edf694313f fix: Gradation properties do not update when a preset is loaded
close #291
2025-01-07 17:23:22 +09:00
mob-sakai 894c5610d0 fix: an error occurs when saving a preset
close #293
2025-01-07 17:23:22 +09:00
mob-sakai f7175c0373 feat: the Allow To Modify Mesh Shape property should remain unchanged when loading a preset
close #294
2025-01-07 17:23:22 +09:00
mob-sakai 238a17d57d feat: the Sampling Scale property should remain unchanged when loading a preset
close #292
2025-01-07 17:23:22 +09:00
fumiko 97237b3aa8 style: apply format 2025-01-07 17:23:22 +09:00
fumiko 1be0cd45db feat: add Use HDR Color Picker option for project settings (editor)
close #290
2025-01-07 17:23:19 +09:00
semantic-release-bot 9799069633 chore(release): 5.1.0 [skip ci]
# [5.1.0](https://github.com/mob-sakai/UIEffect/compare/5.0.2...5.1.0) (2024-12-31)

### Bug Fixes

* changing the `shadowMirrorScale` property via code does not update the effect ([d9bf0e1](https://github.com/mob-sakai/UIEffect/commit/d9bf0e12fe918fc36120be3e1df2acbb00b1762b))
* fix reverse direction mode for UIEffectTweener ([54825ee](https://github.com/mob-sakai/UIEffect/commit/54825eedc8070e74fc276e1e08ea0073cf265189)), closes [#281](https://github.com/mob-sakai/UIEffect/issues/281) [#282](https://github.com/mob-sakai/UIEffect/issues/282) [#283](https://github.com/mob-sakai/UIEffect/issues/283)

### Features

* add `Color Glow`, `Transition Color Glow` and `Shadow Color Glow` options ([e9522d3](https://github.com/mob-sakai/UIEffect/commit/e9522d3f0e3bc0c429ef32f240625e903ca790ee))
* add `GradationMode.Angle` and `GradationMode.AngleGradient` ([08e9ba7](https://github.com/mob-sakai/UIEffect/commit/08e9ba73d78ba52502a6e795587441061377cd99))
* add `OnComplete` event for UIEffectTweener ([aeb78ed](https://github.com/mob-sakai/UIEffect/commit/aeb78ed577d70c47aacd754ea2aa3916e6e49c1b)), closes [#289](https://github.com/mob-sakai/UIEffect/issues/289) [#188](https://github.com/mob-sakai/UIEffect/issues/188)
* add `PlayOnEnable` option for UIEffectTweener ([1558736](https://github.com/mob-sakai/UIEffect/commit/155873669d77fc3281caaa0fc9f861e62aa489f2))
* add `SamplingScale` option ([2b43bc4](https://github.com/mob-sakai/UIEffect/commit/2b43bc42d4a9e0a1c224139ccf91f7a6f76656fc)), closes [#269](https://github.com/mob-sakai/UIEffect/issues/269)
* add `Shadow Color` and `Shadow Blur` options ([d0a3ca6](https://github.com/mob-sakai/UIEffect/commit/d0a3ca60904c0eebf63178a0fb899bb17ecefe75))
* add a button to swap gradation colors (editor) ([20a6ca0](https://github.com/mob-sakai/UIEffect/commit/20a6ca0815aaa899934fde318beecc1dde5e1132))
* add option to not automatically plays tweener effect ([88609f5](https://github.com/mob-sakai/UIEffect/commit/88609f5e368e38224a698270113b4f3190580a19))
* automatically display a dialog to import TextMeshPro support ([f2df188](https://github.com/mob-sakai/UIEffect/commit/f2df1889d152ae68926067978c60b4810fdef3f1))
* gradation feature ([bbe57df](https://github.com/mob-sakai/UIEffect/commit/bbe57df7a0a184793bd6d98a2b929055f69860b3)), closes [#277](https://github.com/mob-sakai/UIEffect/issues/277) [#66](https://github.com/mob-sakai/UIEffect/issues/66)
* on-demand UIEffect shader support ([bdd8e08](https://github.com/mob-sakai/UIEffect/commit/bdd8e0857235c56b7013fe768a333c5575aaa0ef)), closes [#212](https://github.com/mob-sakai/UIEffect/issues/212) [#271](https://github.com/mob-sakai/UIEffect/issues/271)
* support `TextMeshPro/Bitmap` and `TextMeshPro/Mobile/Bitmap` shaders. ([23ac398](https://github.com/mob-sakai/UIEffect/commit/23ac3985d2a2d9497b2d50b3755be671f3a07aa9)), closes [#284](https://github.com/mob-sakai/UIEffect/issues/284)
* support non full-rect graphics for some effect ([a66baea](https://github.com/mob-sakai/UIEffect/commit/a66baea1e8d895c424ba3dc1fce64f969d79561e))
* UIEffectTweener animation preview in edit mode ([e17b4a0](https://github.com/mob-sakai/UIEffect/commit/e17b4a0bfd262dc22ad2a13af5b0571b43a74abd)), closes [#279](https://github.com/mob-sakai/UIEffect/issues/279)
2024-12-31 00:32:24 +00:00
mob-sakai 43bc2e29a8 docs: update 2024-12-31 09:29:51 +09:00
mob-sakai 4a6007a467 demo: update demos 2024-12-31 09:29:51 +09:00
mob-sakai 08e9ba73d7 feat: add GradationMode.Angle and GradationMode.AngleGradient 2024-12-31 09:29:51 +09:00
mob-sakai aeb78ed577 feat: add OnComplete event for UIEffectTweener
close #289, close #188
2024-12-31 09:29:51 +09:00
mob-sakai 7fc8b1599a refactor: change allowExtendVertex to allowToModifyMeshShape 2024-12-31 09:21:30 +09:00
mob-sakai c9fe854b5d refactor 2024-12-31 09:21:30 +09:00
mob-sakai 20a6ca0815 feat: add a button to swap gradation colors (editor) 2024-12-31 09:21:30 +09:00
mob-sakai f2df1889d1 feat: automatically display a dialog to import TextMeshPro support 2024-12-31 09:21:30 +09:00
mob-sakai bbe57df7a0 feat: gradation feature
close #277, close #66
2024-12-31 09:21:30 +09:00
mob-sakai e9522d3f0e feat: add Color Glow, Transition Color Glow and Shadow Color Glow options 2024-12-30 17:03:47 +09:00
mob-sakai d0a3ca6090 feat: add Shadow Color and Shadow Blur options 2024-12-30 17:03:47 +09:00
mob-sakai a66baea1e8 feat: support non full-rect graphics for some effect 2024-12-30 17:03:47 +09:00
mob-sakai 5bee8adc83 refactor: shadow context 2024-12-30 17:03:47 +09:00
mob-sakai 9a97c50c54 style: format 2024-12-30 17:03:47 +09:00
mob-sakai bc20f28ac9 update coffee.internal 2024-12-30 17:03:47 +09:00
mob-sakai d9bf0e12fe fix: changing the shadowMirrorScale property via code does not update the effect 2024-12-30 17:03:47 +09:00
mob-sakai 2b43bc42d4 feat: add SamplingScale option
close #269
2024-12-28 00:15:38 +09:00
mob-sakai 23ac3985d2 feat: support TextMeshPro/Bitmap and TextMeshPro/Mobile/Bitmap shaders.
close #284
2024-12-28 00:15:38 +09:00
mob-sakai e17b4a0bfd feat: UIEffectTweener animation preview in edit mode
close #279
2024-12-28 00:15:37 +09:00
mob-sakai 155873669d feat: add PlayOnEnable option for UIEffectTweener 2024-12-28 00:15:37 +09:00
mob-sakai 54825eedc8 fix: fix reverse direction mode for UIEffectTweener
close #281, close #282, close #283
2024-12-24 19:52:05 +09:00
mob-sakai bdd8e08572 feat: on-demand UIEffect shader support
close #212, close #271
2024-12-24 19:51:17 +09:00
Victor Guilherme 88609f5e36 feat: add option to not automatically plays tweener effect
Added a new option on the tweener effect called "StartMode" to set it to not automatically play on start. eg. you have an image with a UIEffect and UIEffecTweener and do not want the effect to play instantly when the object starts but still want to use Normal/Unscaled update mode to not have to tween values manually in code.
2024-12-24 19:49:48 +09:00
semantic-release-bot 476a0ba23d chore(release): 5.0.2 [skip ci]
## [5.0.2](https://github.com/mob-sakai/UIEffect/compare/5.0.1...5.0.2) (2024-12-24)

### Bug Fixes

* incorrect transparency when applying the shiny filter to TextMeshProUGUI ([f74279f](https://github.com/mob-sakai/UIEffect/commit/f74279fb8353226b494f00582ed5eb7fe87d147f)), closes [#287](https://github.com/mob-sakai/UIEffect/issues/287)
* TextMeshProUGUI disappears when the Y-axis scale is changed ([9d98c5d](https://github.com/mob-sakai/UIEffect/commit/9d98c5d3e1c6ead8e3312a7e3a36fe89b38aed68)), closes [#286](https://github.com/mob-sakai/UIEffect/issues/286)
2024-12-24 03:52:37 +00:00
mob-sakai 9d98c5d3e1 fix: TextMeshProUGUI disappears when the Y-axis scale is changed
close #286
2024-12-24 11:44:54 +09:00
mob-sakai bc11095020 refactor 2024-12-24 10:18:07 +09:00
mob-sakai f74279fb83 fix: incorrect transparency when applying the shiny filter to TextMeshProUGUI
close #287
2024-12-24 10:17:52 +09:00
332 changed files with 95234 additions and 5713 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ env:
# MINIMUM_VERSION: The minimum version of Unity.
MINIMUM_VERSION: 2020.3
# EXCLUDE_FILTER: The excluded versions of Unity.
EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.3)"
EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.2|2023.3)"
on:
workflow_dispatch:
@@ -21,7 +21,7 @@ on:
push:
branches:
- develop
- develop-preview
- "develop-*"
tags:
- "!*"
paths-ignore:
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b679dead51ca64e93a87fbd98e1dbaf5
guid: 97c7740b360fd49ea9da163b5b877c8e
folderAsset: yes
DefaultImporter:
externalObjects: {}
@@ -0,0 +1,838 @@
%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_IndirectSpecularColor: {r: 0.37311924, g: 0.38073963, b: 0.3587269, a: 1}
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: 2
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
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &134336676
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 134336679}
- component: {fileID: 134336678}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!20 &134336678
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 134336676}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
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 &134336679
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 134336676}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &973375176
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 973375179}
- component: {fileID: 973375178}
- component: {fileID: 973375177}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &973375177
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 973375176}
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 &973375178
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 973375176}
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 &973375179
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 973375176}
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_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &986199151
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 986199155}
- component: {fileID: 986199152}
- component: {fileID: 986199154}
- component: {fileID: 986199153}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!223 &986199152
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 986199151}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 1
m_Camera: {fileID: 134336678}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 27
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &986199153
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 986199151}
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 &986199154
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 986199151}
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!224 &986199155
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 986199151}
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: 1567169362}
- {fileID: 1421004027}
m_Father: {fileID: 0}
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_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &1421004026
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1421004027}
- component: {fileID: 1421004030}
- component: {fileID: 1421004029}
- component: {fileID: 1421004028}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1421004027
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1421004026}
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: 986199155}
m_RootOrder: 1
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: 415.4, y: 111.41}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1421004028
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1421004026}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 938fce054c42f40a3969e27a88d9bdd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ToneFilter: 0
m_ToneIntensity: 0.875
m_ToneParams: {x: 0, y: 0, z: 0, w: 0}
m_ColorFilter: 0
m_ColorIntensity: 0.213
m_Color: {r: 0.16862746, g: 0, b: 0.12038653, a: 1}
m_ColorGlow: 0
m_SamplingFilter: 0
m_SamplingIntensity: 0.622
m_SamplingWidth: 1
m_SamplingScale: 1
m_TransitionFilter: 8
m_TransitionRate: 0
m_TransitionReverse: 0
m_TransitionTex: {fileID: 2800000, guid: 40d1a96251dfd4353a7d28680e56c2e7, type: 3}
m_TransitionTexScale: {x: 1, y: 1}
m_TransitionTexOffset: {x: 0, y: 0}
m_TransitionRotation: 45
m_TransitionKeepAspectRatio: 1
m_TransitionWidth: 0.85
m_TransitionSoftness: 0.475
m_TransitionRange:
m_Min: 0
m_Max: 1
m_TransitionColorFilter: 1
m_TransitionColor: {r: 0, g: 0, b: 0, a: 0.5019608}
m_TransitionColorGlow: 0
m_TransitionPatternReverse: 0
m_TransitionAutoPlaySpeed: 0.5
m_TargetMode: 0
m_TargetColor: {r: 1, g: 1, b: 1, a: 1}
m_TargetRange: 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_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_EdgeShinyRate: 0.5
m_EdgeShinyWidth: 0.5
m_EdgeShinyAutoPlaySpeed: 1
m_PatternArea: 1
--- !u!114 &1421004029
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1421004026}
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: 4 Color Gradation
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: bc6ef582a0efa420683ff976adff235a, type: 2}
m_sharedMaterial: {fileID: 2100000, guid: cab5405a1d5e24ca7858d78bc295cc25, 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: 81.94
m_fontSizeBase: 81.94
m_fontWeight: 400
m_enableAutoSizing: 0
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 &1421004030
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1421004026}
m_CullTransparentMesh: 1
--- !u!1 &1567169361
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1567169362}
- component: {fileID: 1567169365}
- component: {fileID: 1567169364}
- component: {fileID: 1567169363}
- component: {fileID: 1567169366}
m_Layer: 5
m_Name: Gradation
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1567169362
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1567169361}
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: 986199155}
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 &1567169363
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1567169361}
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.4142135, g: 1.4142135, b: 1.4142135, 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_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: 11
m_GradationColor1: {r: 0.514151, g: 1, b: 0.9449037, a: 1}
m_GradationColor2: {r: 0.8476167, g: 1, b: 0.5330188, a: 1}
m_GradationColor3: {r: 0.6840595, g: 0.5801887, b: 1, a: 1}
m_GradationColor4: {r: 1, g: 0.63528705, b: 0.6273585, 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}
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
ctime6: 56173
ctime7: 65535
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 8
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_EdgeShinyRate: 0.5
m_EdgeShinyWidth: 0.5
m_EdgeShinyAutoPlaySpeed: 1
m_PatternArea: 1
--- !u!114 &1567169364
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1567169361}
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: 1
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1567169365
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1567169361}
m_CullTransparentMesh: 1
--- !u!114 &1567169366
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1567169361}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 90ac5d06c7b714c29a6b7b3b80e443a7, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CullingMask: 32
m_Direction: 0
m_Curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0.44500732
inSlope: 0
outSlope: 0.21999359
tangentMode: 69
weightedMode: 0
inWeight: 0
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0.6650009
inSlope: 0.21999359
outSlope: 1
tangentMode: 69
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_Delay: 0
m_Duration: 3
m_Interval: 0
m_PlayOnEnable: 1
m_ResetTimeOnEnable: 1
m_WrapMode: 3
m_UpdateMode: 0
m_OnComplete:
m_PersistentCalls:
m_Calls: []
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d9fda278a556f4bd6bf27213319aaf06
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,14 @@
using Coffee.UIEffects;
using UnityEngine;
public class GradationTest : MonoBehaviour
{
[SerializeField] private UIEffect m_Target;
[SerializeField] private Gradient m_Gradient;
public void SetGradation()
{
m_Target.SetGradientKeys(m_Gradient.colorKeys, m_Gradient.alphaKeys, m_Gradient.mode);
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f901d0537c0db429e808496022199910
guid: 7c663eb03b2fb4828bc3ade4aff915c5
MonoImporter:
externalObjects: {}
serializedVersion: 2
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 54b78b8690dfe482aaaad53253d23214
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 690 KiB

File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d2a4c1061dec2448abe5ae1b412140af
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
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,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 - Mobile
m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, 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: 1f0416a8fecb64e86b4d6c301e638f2d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,109 @@
%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 - Outline
m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3}
m_ValidKeywords:
- OUTLINE_ON
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.25
- _PerspectiveFilter: 0.875
- _Reflectivity: 10
- _ScaleRatioA: 0.9
- _ScaleRatioB: 0.73125
- _ScaleRatioC: 0.365625
- _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: 1
- _UnderlayOffsetX: 1
- _UnderlayOffsetY: -1
- _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: 0.5019608}
- _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: cab5405a1d5e24ca7858d78bc295cc25
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 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:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e4e892194038942ed9ff756a9f5b0dba
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
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.6.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: 09ae172f2711c4f2cafc2417dac00d34
guid: 8d415f5270a5d45608931175d5835110
MonoImporter:
externalObjects: {}
serializedVersion: 2
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 15dc1da3b4d49479897101a68acaa39f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 14bf4da62b8434d7ca6e6a7e8b63e4ea
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 43c4f102824e943cf859c0d6c966b9fa
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+3 -2
View File
@@ -18,11 +18,12 @@ MonoBehaviour:
m_EnabledInEditor: 1
m_AlwaysIncludeAssembly: 1
m_InstantiateOnLoad: 1
m_Prefab: {fileID: 7211429669315726685, guid: 78a484d8074c74e9c80786d1e55962c8,
m_Prefab: {fileID: 4567906826058368312, guid: 7cebff2d255b9433cbe23b243c193329,
type: 3}
m_Interval: 0.5
m_Anchor: 0
m_Width: 750
m_Width: 800
m_HelpUrl: https://github.com/mob-sakai/UIEffect
m_CustomMonitorItems:
- m_Format: Screen:{0}x{1}
m_Arg0:
File diff suppressed because it is too large Load Diff
@@ -8,6 +8,47 @@ ShaderVariantCollection:
m_PrefabAsset: {fileID: 0}
m_Name: UIEffectShaderVariants
m_Shaders:
- first: {fileID: 4800000, guid: 935b7be1c88464d2eb87204fdfab5a38, type: 3}
second:
variants:
- keywords: COLOR_HSV_MODIFIER GLOW_ON UNDERLAY_ON
passType: 0
- keywords: COLOR_MULTIPLY GLOW_ON UNDERLAY_ON
passType: 0
- keywords: EDGE_COLOR_REPLACE 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 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
- first: {fileID: 4800000, guid: 96246b1ead49a4c5a996fd477bc5a117, type: 3}
second:
variants:
@@ -15,10 +56,6 @@ ShaderVariantCollection:
passType: 0
- keywords: COLOR_ADDITIVE
passType: 0
- keywords: COLOR_ADDITIVE SAMPLING_BLUR_FAST
passType: 0
- keywords: COLOR_ADDITIVE SAMPLING_BLUR_FAST UNITY_UI_CLIP_RECT
passType: 0
- keywords: COLOR_CONTRAST
passType: 0
- keywords: COLOR_HSV_MODIFIER
@@ -29,60 +66,7 @@ ShaderVariantCollection:
passType: 0
- keywords: COLOR_MULTIPLY
passType: 0
- keywords: COLOR_MULTIPLY_ADDITIVE
passType: 0
- keywords: COLOR_MULTIPLY_ADDITIVE SAMPLING_BLUR_FAST TONE_GRAYSCALE TRANSITION_COLOR_MULTIPLY_ADDITIVE
TRANSITION_DISSOLVE
passType: 0
- keywords: COLOR_REPLACE SAMPLING_BLUR_FAST
passType: 0
- keywords: SAMPLING_BLUR_DETAIL
passType: 0
- keywords: TONE_GRAYSCALE
passType: 0
- keywords: TONE_SEPIA
passType: 0
- keywords: TONE_NEGATIVE
passType: 0
- keywords: TONE_RETRO
passType: 0
- keywords: TONE_POSTERIZE
passType: 0
- keywords: COLOR_MULTIPLY
passType: 0
- keywords: COLOR_ADDITIVE
passType: 0
- keywords: COLOR_SUBTRACTIVE
passType: 0
- keywords: COLOR_REPLACE
passType: 0
- keywords: COLOR_MULTIPLY_LUMINANCE
passType: 0
- keywords: COLOR_MULTIPLY_ADDITIVE
passType: 0
- keywords: COLOR_HSV_MODIFIER
passType: 0
- keywords: COLOR_CONTRAST
passType: 0
- keywords: COLOR_HSV_MODIFIER TARGET_HUE
passType: 0
- keywords: COLOR_REPLACE SAMPLING_BLUR_FAST
passType: 0
- keywords: SAMPLING_BLUR_FAST
passType: 0
- keywords: SAMPLING_BLUR_FAST TONE_GRAYSCALE
passType: 0
- keywords: COLOR_ADDITIVE SAMPLING_BLUR_FAST
passType: 0
- keywords: COLOR_ADDITIVE SAMPLING_BLUR_FAST UNITY_UI_CLIP_RECT
passType: 0
- keywords: COLOR_HSV_MODIFIER
passType: 0
- keywords: COLOR_HSV_MODIFIER TARGET_HUE
passType: 0
- keywords: COLOR_HSV_MODIFIER TARGET_LUMINANCE
passType: 0
- keywords: COLOR_MULTIPLY
- keywords: COLOR_MULTIPLY SHADOW_COLOR_REPLACE
passType: 0
- keywords: COLOR_MULTIPLY_ADDITIVE
passType: 0
@@ -93,23 +77,47 @@ ShaderVariantCollection:
passType: 0
- keywords: COLOR_REPLACE
passType: 0
- keywords: COLOR_REPLACE SAMPLING_BLUR_FAST
passType: 0
- keywords: COLOR_SUBTRACTIVE
passType: 0
- keywords: SAMPLING_BLUR_DETAIL
- keywords: DETAIL_ADDITIVE
passType: 0
- keywords: SAMPLING_BLUR_FAST
- keywords: DETAIL_MASKING
passType: 0
- keywords: SAMPLING_BLUR_FAST TONE_GRAYSCALE
- keywords: DETAIL_MULTIPLY
passType: 0
- keywords: SAMPLING_BLUR_MEDIUM
- keywords: DETAIL_MULTIPLY EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_SHINY
passType: 0
- keywords: DETAIL_MULTIPLY_ADDITIVE
passType: 0
- keywords: DETAIL_REPLACE
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_PLAIN
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_PLAIN SHADOW_COLOR_MULTIPLY_ADDITIVE
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_SHINY
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_SHINY SAMPLING_EDGE_ALPHA
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_SHINY SHADOW_COLOR_MULTIPLY_ADDITIVE
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_SHINY TRANSITION_COLOR_MULTIPLY
TRANSITION_PATTERN
passType: 0
- keywords: EDGE_COLOR_MULTIPLY_ADDITIVE EDGE_SHINY TRANSITION_COLOR_MULTIPLY_ADDITIVE
TRANSITION_PATTERN
passType: 0
- keywords: EDGE_PLAIN SHADOW_COLOR_REPLACE TRANSITION_COLOR_MULTIPLY TRANSITION_PATTERN
passType: 0
- keywords: EDGE_PLAIN TRANSITION_COLOR_MULTIPLY TRANSITION_PATTERN
passType: 0
- keywords: SAMPLING_BLUR_DETAIL
passType: 0
- keywords: SAMPLING_BLUR_FAST
passType: 0
- keywords: SAMPLING_BLUR_FAST TONE_GRAYSCALE
- keywords: SAMPLING_BLUR_FAST SHADOW_COLOR_MULTIPLY_ADDITIVE TONE_GRAYSCALE
passType: 0
- keywords: SAMPLING_BLUR_FAST SHADOW_COLOR_REPLACE
passType: 0
- keywords: SAMPLING_BLUR_MEDIUM
passType: 0
@@ -127,46 +135,7 @@ ShaderVariantCollection:
passType: 0
- keywords: SAMPLING_RGB_SHIFT
passType: 0
- keywords: SAMPLING_EDGE_LUMINANCE
passType: 0
- keywords: SAMPLING_EDGE_ALPHA
passType: 0
- keywords: SAMPLING_PIXELATION
passType: 0
- keywords: SAMPLING_PIXELATION TONE_RETRO
passType: 0
- keywords: SAMPLING_PIXELATION TONE_RETRO UNITY_UI_CLIP_RECT
passType: 0
- keywords: SAMPLING_RGB_SHIFT
passType: 0
- keywords: TONE_GRAYSCALE
passType: 0
- keywords: TONE_NEGATIVE
passType: 0
- keywords: TONE_POSTERIZE
passType: 0
- keywords: TONE_RETRO
passType: 0
- keywords: TRANSITION_BURN TRANSITION_COLOR_MULTIPLY_ADDITIVE
passType: 0
- keywords: TRANSITION_BURN TRANSITION_COLOR_MULTIPLY_ADDITIVE UNITY_UI_CLIP_RECT
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_DISSOLVE
passType: 0
- keywords: TRANSITION_FADE
passType: 0
- keywords: TRANSITION_CUTOFF
passType: 0
- keywords: TRANSITION_COLOR_REPLACE TRANSITION_MELT
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: COLOR_MULTIPLY_ADDITIVE SAMPLING_BLUR_FAST TONE_GRAYSCALE TRANSITION_COLOR_MULTIPLY_ADDITIVE
TRANSITION_DISSOLVE
passType: 0
- keywords: SAMPLING_PIXELATION TONE_RETRO UNITY_UI_CLIP_RECT
- keywords: SHADOW_COLOR_REPLACE
passType: 0
- keywords: TONE_GRAYSCALE
passType: 0
@@ -182,6 +151,10 @@ ShaderVariantCollection:
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 TRANSITION_PATTERN UNITY_UI_CLIP_RECT
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_DISSOLVE
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_DISSOLVE UNITY_UI_CLIP_RECT
@@ -190,29 +163,9 @@ ShaderVariantCollection:
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_MELT
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_MULTIPLY_ADDITIVE TRANSITION_MASK
passType: 0
- keywords: SAMPLING_EDGE_LUMINANCE 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_BURN TRANSITION_COLOR_MULTIPLY_ADDITIVE
passType: 0
- keywords: TRANSITION_BURN TRANSITION_COLOR_MULTIPLY_ADDITIVE UNITY_UI_CLIP_RECT
passType: 0
- keywords: COLOR_HSV_MODIFIER TARGET_HUE
passType: 0
- keywords: COLOR_HSV_MODIFIER TARGET_LUMINANCE
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_DISSOLVE
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_MELT UNITY_UI_CLIP_RECT
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_PATTERN
passType: 0
- keywords: TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_SHINY
passType: 0
@@ -224,66 +177,6 @@ ShaderVariantCollection:
passType: 0
- keywords: TRANSITION_FADE
passType: 0
- first: {fileID: 4800000, guid: 935b7be1c88464d2eb87204fdfab5a38, type: 3}
second:
variants:
- keywords: GLOW_ON TONE_RETRO UNDERLAY_ON
passType: 0
- keywords: COLOR_HSV_MODIFIER GLOW_ON UNDERLAY_ON
passType: 0
- keywords: COLOR_ADDITIVE GLOW_ON SAMPLING_BLUR_FAST UNDERLAY_ON
passType: 0
- keywords: GLOW_ON SAMPLING_BLUR_DETAIL UNDERLAY_ON
passType: 0
- keywords: GLOW_ON SAMPLING_PIXELATION UNDERLAY_ON
passType: 0
- keywords: SAMPLING_PIXELATION TONE_RETRO
passType: 0
- keywords: GLOW_ON SAMPLING_RGB_SHIFT UNDERLAY_ON
passType: 0
- keywords: GLOW_ON SAMPLING_EDGE_LUMINANCE UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_COLOR_REPLACE TRANSITION_MELT 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_SHINY UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_COLOR_MULTIPLY_ADDITIVE TRANSITION_MELT UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_BURN TRANSITION_COLOR_MULTIPLY_ADDITIVE UNDERLAY_ON
passType: 0
- first: {fileID: 4800000, guid: c67f821adbb6348a3a21573a25b55de0, type: 3}
second:
variants:
- keywords: COLOR_ADDITIVE GLOW_ON SAMPLING_BLUR_FAST UNDERLAY_ON
passType: 0
- keywords: COLOR_HSV_MODIFIER 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 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 TRANSITION_COLOR_MULTIPLY_ADDITIVE 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_SHINY UNDERLAY_ON
passType: 0
- keywords: GLOW_ON TRANSITION_COLOR_REPLACE TRANSITION_MELT UNDERLAY_ON
passType: 0
- keywords: SAMPLING_PIXELATION TONE_RETRO
passType: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -300,6 +193,28 @@ MonoBehaviour:
m_RuntimePresets:
- {fileID: 1645081683573595507, guid: 3b09ad143990c4c8795c6e93760e132a, type: 3}
- {fileID: 1645081683573595507, guid: 4f70ff0f1e25b4388b9bcb38d619f7bf, type: 3}
m_FallbackVariantBehaviour: 0
m_UnregisteredShaderVariants: []
m_UseHDRColorPicker: 1
m_ShaderVariantCollection: {fileID: -8740588384831342173}
m_ShaderVariantRegistry:
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: []
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e9a477d4a32184f16b50f56f7de5fa4e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 962016ab124fa4720be1e24ff58c8522
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,12 @@
{
"name": "Coffee.UIEffect.EditorTests",
"references": [
"Coffee.UIEffect"
],
"optionalUnityReferences": [
"TestAssemblies"
],
"includePlatforms": [
"Editor"
]
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 182e53eada385475e905b8ca6d82d6ad
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Reflection;
using NUnit.Framework;
using UnityEditor;
public class ReflectionTests
{
[Test]
public void ShaderVariantCollectionInspector_DrawShaderEntry()
{
var type = Type.GetType("UnityEditor.ShaderVariantCollectionInspector, UnityEditor");
Assert.IsNotNull(type, "'UnityEditor.ShaderVariantCollectionInspector, UnityEditor' is not found");
var miDrawShaderEntry = type.GetMethod("DrawShaderEntry", BindingFlags.NonPublic | BindingFlags.Instance);
Assert.IsNotNull(miDrawShaderEntry);
var parameters = miDrawShaderEntry.GetParameters();
Assert.AreEqual(1, parameters.Length);
Assert.AreEqual(typeof(int), parameters[0].ParameterType);
}
[Test]
public void SerializedProperty_gradientValue()
{
var piGradient = typeof(SerializedProperty)
.GetProperty("gradientValue", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
Assert.IsNotNull(piGradient);
Assert.IsTrue(piGradient.CanRead);
Assert.IsTrue(piGradient.CanWrite);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7c5d391ce913d41fb9118c3d28b21059
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+2
View File
@@ -1,7 +1,9 @@
{
"dependencies": {
"com.coffee.development": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/Development",
"com.coffee.minimal-resource": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/MinimalResource",
"com.coffee.nano-monitor": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
"com.coffee.symbolic-linker": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/SymbolicLinker",
"com.unity.ide.rider": "3.0.34",
"com.unity.test-framework": "1.1.33",
"com.unity.textmeshpro": "3.0.9",
+16 -2
View File
@@ -5,7 +5,14 @@
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "805474a9e49f534ff01bf75405bcd415ed57083c"
"hash": "2045eaab5b485827cef8bf0bb9e1552dce4f8d6d"
},
"com.coffee.minimal-resource": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/MinimalResource",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "2bd2bf356dd692a39de9db2ff11faaf79fbfaea3"
},
"com.coffee.nano-monitor": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
@@ -14,7 +21,14 @@
"dependencies": {
"com.unity.ugui": "1.0.0"
},
"hash": "4e5f735ccf956ee469b5014ae781068c49a2825d"
"hash": "2045eaab5b485827cef8bf0bb9e1552dce4f8d6d"
},
"com.coffee.symbolic-linker": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/SymbolicLinker",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "3c280f1a8f4db5038b881ff07f270efd9638fa31"
},
"com.coffee.ui-effect": {
"version": "file:src",
+202
View File
@@ -1,3 +1,205 @@
# [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)
### Bug Fixes
* fix v4 compatible components ([6f6a8c9](https://github.com/mob-sakai/UIEffect/commit/6f6a8c95f878a290b1c4238cd0519f14febc04b6))
* fully visible when the transition rate is set to 1 ([0a99bb7](https://github.com/mob-sakai/UIEffect/commit/0a99bb7765443a84070e19c9ea0096808442932e)), closes [#309](https://github.com/mob-sakai/UIEffect/issues/309)
* UIEffect with TextMeshPro appears black in the editor when saving scene ([8cbcd76](https://github.com/mob-sakai/UIEffect/commit/8cbcd765ed9e11c38e3257191c2fc7dcd2c9916e))
# [5.5.0](https://github.com/mob-sakai/UIEffect/compare/5.4.0...5.5.0) (2025-02-12)
### Features
* add `GradationMode.Diagonal` with 4 colors ([b72a1c0](https://github.com/mob-sakai/UIEffect/commit/b72a1c05c6d1d7b3c0aa11582d4a97da80d7fce9)), closes [#308](https://github.com/mob-sakai/UIEffect/issues/308)
* add built-in presets ([8930b56](https://github.com/mob-sakai/UIEffect/commit/8930b563cb580463e2265483ccd3a42cb84e644b))
# [5.4.0](https://github.com/mob-sakai/UIEffect/compare/5.3.4...5.4.0) (2025-02-10)
### Bug Fixes
* gradient color is not updated when calling the `SetGradientKeys` method ([a959fdd](https://github.com/mob-sakai/UIEffect/commit/a959fddd34a93dd0846369938b1cb6be514eee2d))
### Features
* tweener supports `EdgeMode.Shiny` ([32558d4](https://github.com/mob-sakai/UIEffect/commit/32558d4481de31ed9020c82861dc2a2d8ca7d53c)), closes [#307](https://github.com/mob-sakai/UIEffect/issues/307)
## [5.3.4](https://github.com/mob-sakai/UIEffect/compare/5.3.3...5.3.4) (2025-02-10)
### Bug Fixes
* UIEffect v5.3.3 with TextMeshPro is not working in play mode in editor ([365c43e](https://github.com/mob-sakai/UIEffect/commit/365c43e21dcaaff349cf1362f9bd25b7deb163f7)), closes [#306](https://github.com/mob-sakai/UIEffect/issues/306)
## [5.3.3](https://github.com/mob-sakai/UIEffect/compare/5.3.2...5.3.3) (2025-02-06)
### Bug Fixes
* when modifying TextMeshPro vertices, element disapear ([7529a7c](https://github.com/mob-sakai/UIEffect/commit/7529a7c4cd8db27a6d3312bce0a6ed6b13e40f35)), closes [#305](https://github.com/mob-sakai/UIEffect/issues/305)
## [5.3.2](https://github.com/mob-sakai/UIEffect/compare/5.3.1...5.3.2) (2025-02-04)
### Bug Fixes
* some effects are not working correctly for TextMeshProUGUI in Unity 6 ([63de374](https://github.com/mob-sakai/UIEffect/commit/63de3742ecd7fcdcaa8dcca8dc104c7288291211))
## [5.3.1](https://github.com/mob-sakai/UIEffect/compare/5.3.0...5.3.1) (2025-01-27)
### Bug Fixes
* shader keywords for UIEfect are not recognized in Unity 6 ([fd39abf](https://github.com/mob-sakai/UIEffect/commit/fd39abf5a71138919f8feee587576ba187075304)), closes [#301](https://github.com/mob-sakai/UIEffect/issues/301)
# [5.3.0](https://github.com/mob-sakai/UIEffect/compare/5.2.4...5.3.0) (2025-01-26)
### Features
* `SamplingFilter.EdgeAlpha` and `SamplingFilter.EdgeLuminance` now support the `Sampling Width` property for edge width ([33b1177](https://github.com/mob-sakai/UIEffect/commit/33b1177815b935a887c5a8918748cbeafec32b6b))
* add `EdgeMode` feature ([eadb477](https://github.com/mob-sakai/UIEffect/commit/eadb477bcd91f8909bfa7b8976241411363ee12c))
* add `ResetOnEnable` option for `UIEffectTweener` ([e326bb7](https://github.com/mob-sakai/UIEffect/commit/e326bb77537b921df775646142105a490ae54851)), closes [#299](https://github.com/mob-sakai/UIEffect/issues/299)
* add `TransitionAutoSpeed` property ([7a765c3](https://github.com/mob-sakai/UIEffect/commit/7a765c32d87f6dfbdb990d5b3a272dd80696b374))
* add `TransitionFilter.Pattern` feature ([b57e98b](https://github.com/mob-sakai/UIEffect/commit/b57e98b64c61a7c7eb3ca97f3bd7e909956ee469))
## [5.2.4](https://github.com/mob-sakai/UIEffect/compare/5.2.3...5.2.4) (2025-01-26)
### Bug Fixes
* properties may not update correctly when changed via code or animation ([5994f88](https://github.com/mob-sakai/UIEffect/commit/5994f8875ed2280e5c863c30f9c7900d4dce70ed)), closes [#300](https://github.com/mob-sakai/UIEffect/issues/300)
## [5.2.3](https://github.com/mob-sakai/UIEffect/compare/5.2.2...5.2.3) (2025-01-23)
### Bug Fixes
* `SamplingFilter.None` now correctly respects the sampling scale setting ([bc1578b](https://github.com/mob-sakai/UIEffect/commit/bc1578b0ca91b830b976bf200d387d0ac6963ae6))
* fix the shadow mode inspector in editor ([da53585](https://github.com/mob-sakai/UIEffect/commit/da535854ccbeeb98b2556423425d39058bd5f479))
* UIEffect may not work correctly when using `FallbackAtlas` with TextMeshProUGUI ([d3779f9](https://github.com/mob-sakai/UIEffect/commit/d3779f9f57d0410fa4526527ebed30885bfbc2dd)), closes [#298](https://github.com/mob-sakai/UIEffect/issues/298)
## [5.2.2](https://github.com/mob-sakai/UIEffect/compare/5.2.1...5.2.2) (2025-01-18)
### Bug Fixes
* in Unity 6, `Shadow Color` has no effect on TextMeshPro ([6e4d4ab](https://github.com/mob-sakai/UIEffect/commit/6e4d4ab03db786e4c28d0f2c57d9e58655c5d029)), closes [#297](https://github.com/mob-sakai/UIEffect/issues/297)
## [5.2.1](https://github.com/mob-sakai/UIEffect/compare/5.2.0...5.2.1) (2025-01-14)
### Bug Fixes
* shadow color being transparent at maximum `Shadow Fade` ([1d849e5](https://github.com/mob-sakai/UIEffect/commit/1d849e54cb57218a67afc2f8ad36d345bfdd0f74)), closes [#296](https://github.com/mob-sakai/UIEffect/issues/296)
* TextMeshPro is not displayed in prefab mode ([2b44837](https://github.com/mob-sakai/UIEffect/commit/2b44837bb9c93e1cc817a2c1cd112b244cd09391)), closes [#295](https://github.com/mob-sakai/UIEffect/issues/295)
* TextMeshProUGUI disappears when the Y-axis scale is changed ([8159c09](https://github.com/mob-sakai/UIEffect/commit/8159c091e8a6805a7781046ae0f660a3be13862c)), closes [#295](https://github.com/mob-sakai/UIEffect/issues/295)
# [5.2.0](https://github.com/mob-sakai/UIEffect/compare/5.1.0...5.2.0) (2025-01-07)
### Bug Fixes
* `Gradation` properties do not update when a preset is loaded ([edf6943](https://github.com/mob-sakai/UIEffect/commit/edf694313f101b66f760bca64593fb87037dcb3d)), closes [#291](https://github.com/mob-sakai/UIEffect/issues/291)
* an error occurs when saving a preset ([894c561](https://github.com/mob-sakai/UIEffect/commit/894c5610d044f211067037b6c69f9860ac496ffc)), closes [#293](https://github.com/mob-sakai/UIEffect/issues/293)
* fix gradation gradient edge (angle gradient) ([0ef6027](https://github.com/mob-sakai/UIEffect/commit/0ef60273714c7b68131f2f0d233b16335a5cd367))
### Features
* `Angle Gradient` gradation supports fixed mode gradient ([7cb8325](https://github.com/mob-sakai/UIEffect/commit/7cb8325e445350d2175865f736186f719e1cbe00))
* `Angle Gradient` gradation supports RectTransform pivot ([2f63adf](https://github.com/mob-sakai/UIEffect/commit/2f63adfba057bec7f8183a5b34654cdf84163a34))
* add `Use HDR Color Picker` option for project settings (editor) ([1be0cd4](https://github.com/mob-sakai/UIEffect/commit/1be0cd45db952d05e51d508c58f65a6541df9de0)), closes [#290](https://github.com/mob-sakai/UIEffect/issues/290)
* the `Allow To Modify Mesh Shape` property should remain unchanged when loading a preset ([f7175c0](https://github.com/mob-sakai/UIEffect/commit/f7175c037371278eb7a0c7883cffccb5c31dba0a)), closes [#294](https://github.com/mob-sakai/UIEffect/issues/294)
* the `Sampling Scale` property should remain unchanged when loading a preset ([238a17d](https://github.com/mob-sakai/UIEffect/commit/238a17d57ddf1f6b859ce830e80a1be6c3d739f1)), closes [#292](https://github.com/mob-sakai/UIEffect/issues/292)
# [5.1.0](https://github.com/mob-sakai/UIEffect/compare/5.0.2...5.1.0) (2024-12-31)
### Bug Fixes
* changing the `shadowMirrorScale` property via code does not update the effect ([d9bf0e1](https://github.com/mob-sakai/UIEffect/commit/d9bf0e12fe918fc36120be3e1df2acbb00b1762b))
* fix reverse direction mode for UIEffectTweener ([54825ee](https://github.com/mob-sakai/UIEffect/commit/54825eedc8070e74fc276e1e08ea0073cf265189)), closes [#281](https://github.com/mob-sakai/UIEffect/issues/281) [#282](https://github.com/mob-sakai/UIEffect/issues/282) [#283](https://github.com/mob-sakai/UIEffect/issues/283)
### Features
* add `Color Glow`, `Transition Color Glow` and `Shadow Color Glow` options ([e9522d3](https://github.com/mob-sakai/UIEffect/commit/e9522d3f0e3bc0c429ef32f240625e903ca790ee))
* add `GradationMode.Angle` and `GradationMode.AngleGradient` ([08e9ba7](https://github.com/mob-sakai/UIEffect/commit/08e9ba73d78ba52502a6e795587441061377cd99))
* add `OnComplete` event for UIEffectTweener ([aeb78ed](https://github.com/mob-sakai/UIEffect/commit/aeb78ed577d70c47aacd754ea2aa3916e6e49c1b)), closes [#289](https://github.com/mob-sakai/UIEffect/issues/289) [#188](https://github.com/mob-sakai/UIEffect/issues/188)
* add `PlayOnEnable` option for UIEffectTweener ([1558736](https://github.com/mob-sakai/UIEffect/commit/155873669d77fc3281caaa0fc9f861e62aa489f2))
* add `SamplingScale` option ([2b43bc4](https://github.com/mob-sakai/UIEffect/commit/2b43bc42d4a9e0a1c224139ccf91f7a6f76656fc)), closes [#269](https://github.com/mob-sakai/UIEffect/issues/269)
* add `Shadow Color` and `Shadow Blur` options ([d0a3ca6](https://github.com/mob-sakai/UIEffect/commit/d0a3ca60904c0eebf63178a0fb899bb17ecefe75))
* add a button to swap gradation colors (editor) ([20a6ca0](https://github.com/mob-sakai/UIEffect/commit/20a6ca0815aaa899934fde318beecc1dde5e1132))
* add option to not automatically plays tweener effect ([88609f5](https://github.com/mob-sakai/UIEffect/commit/88609f5e368e38224a698270113b4f3190580a19))
* automatically display a dialog to import TextMeshPro support ([f2df188](https://github.com/mob-sakai/UIEffect/commit/f2df1889d152ae68926067978c60b4810fdef3f1))
* gradation feature ([bbe57df](https://github.com/mob-sakai/UIEffect/commit/bbe57df7a0a184793bd6d98a2b929055f69860b3)), closes [#277](https://github.com/mob-sakai/UIEffect/issues/277) [#66](https://github.com/mob-sakai/UIEffect/issues/66)
* on-demand UIEffect shader support ([bdd8e08](https://github.com/mob-sakai/UIEffect/commit/bdd8e0857235c56b7013fe768a333c5575aaa0ef)), closes [#212](https://github.com/mob-sakai/UIEffect/issues/212) [#271](https://github.com/mob-sakai/UIEffect/issues/271)
* support `TextMeshPro/Bitmap` and `TextMeshPro/Mobile/Bitmap` shaders. ([23ac398](https://github.com/mob-sakai/UIEffect/commit/23ac3985d2a2d9497b2d50b3755be671f3a07aa9)), closes [#284](https://github.com/mob-sakai/UIEffect/issues/284)
* support non full-rect graphics for some effect ([a66baea](https://github.com/mob-sakai/UIEffect/commit/a66baea1e8d895c424ba3dc1fce64f969d79561e))
* UIEffectTweener animation preview in edit mode ([e17b4a0](https://github.com/mob-sakai/UIEffect/commit/e17b4a0bfd262dc22ad2a13af5b0571b43a74abd)), closes [#279](https://github.com/mob-sakai/UIEffect/issues/279)
## [5.0.2](https://github.com/mob-sakai/UIEffect/compare/5.0.1...5.0.2) (2024-12-24)
### Bug Fixes
* incorrect transparency when applying the shiny filter to TextMeshProUGUI ([f74279f](https://github.com/mob-sakai/UIEffect/commit/f74279fb8353226b494f00582ed5eb7fe87d147f)), closes [#287](https://github.com/mob-sakai/UIEffect/issues/287)
* TextMeshProUGUI disappears when the Y-axis scale is changed ([9d98c5d](https://github.com/mob-sakai/UIEffect/commit/9d98c5d3e1c6ead8e3312a7e3a36fe89b38aed68)), closes [#286](https://github.com/mob-sakai/UIEffect/issues/286)
## [5.0.1](https://github.com/mob-sakai/UIEffect/compare/5.0.0...5.0.1) (2024-12-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:
+414 -34
View File
@@ -2,10 +2,8 @@
using UnityEngine;
using System.Linq;
using System;
using System.Reflection;
using Object = UnityEngine.Object;
#if TMP_ENABLE
using TMPro;
#endif
namespace Coffee.UIEffects.Editors
{
@@ -14,30 +12,54 @@ namespace Coffee.UIEffects.Editors
/// </summary>
[CustomEditor(typeof(UIEffect), true)]
[CanEditMultipleObjects]
public class UIEffect2Editor : Editor
public class UIEffectEditor : Editor
{
private class UIEffectEditorSettings : ScriptableSingleton<UIEffectEditorSettings>
{
public bool m_ExpandOthers = true;
}
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 _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;
@@ -54,8 +76,49 @@ namespace Coffee.UIEffects.Editors
private SerializedProperty _shadowDistanceY;
private SerializedProperty _shadowIteration;
private SerializedProperty _shadowFade;
private SerializedProperty _shadowEffectOnOrigin;
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 _edgeColorGlow;
private SerializedProperty _edgeShinyRate;
private SerializedProperty _edgeShinyWidth;
private SerializedProperty _edgeShinyAutoPlaySpeed;
private SerializedProperty _patternArea;
private SerializedProperty _detailFilter;
private SerializedProperty _detailIntensity;
private SerializedProperty _detailThreshold;
private SerializedProperty _detailTex;
private SerializedProperty _detailTexScale;
private SerializedProperty _detailTexOffset;
private SerializedProperty _detailTexSpeed;
private SerializedProperty _allowToModifyMeshShape;
private SerializedProperty _customRoot;
private SerializedProperty _flip;
private static bool expandOthers
{
set => UIEffectEditorSettings.instance.m_ExpandOthers = value;
get => UIEffectEditorSettings.instance.m_ExpandOthers;
}
private void OnEnable()
{
@@ -63,27 +126,34 @@ namespace Coffee.UIEffects.Editors
_toneFilter = serializedObject.FindProperty("m_ToneFilter");
_toneIntensity = serializedObject.FindProperty("m_ToneIntensity");
var toneParams = serializedObject.FindProperty("m_ToneParams");
_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");
_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");
_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");
_targetMode = serializedObject.FindProperty("m_TargetMode");
_targetColor = serializedObject.FindProperty("m_TargetColor");
@@ -100,8 +170,43 @@ namespace Coffee.UIEffects.Editors
_shadowDistanceY = _shadowDistance.FindPropertyRelative("y");
_shadowIteration = serializedObject.FindProperty("m_ShadowIteration");
_shadowFade = serializedObject.FindProperty("m_ShadowFade");
_shadowEffectOnOrigin = serializedObject.FindProperty("m_ShadowEffectOnOrigin");
_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");
_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");
_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");
_allowToModifyMeshShape = serializedObject.FindProperty("m_AllowToModifyMeshShape");
_customRoot = serializedObject.FindProperty("m_CustomRoot");
_flip = serializedObject.FindProperty("m_Flip");
}
public override void OnInspectorGUI()
@@ -122,7 +227,6 @@ namespace Coffee.UIEffects.Editors
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_toneIntensity);
EditorGUI.indentLevel--;
}
@@ -133,7 +237,8 @@ namespace Coffee.UIEffects.Editors
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_colorIntensity);
DrawColor(_colorFilter, _color, prevColorFilter);
DrawColor(_color, (ColorFilter)_colorFilter.intValue, prevColorFilter, false);
EditorGUILayout.PropertyField(_colorGlow);
EditorGUI.indentLevel--;
}
@@ -145,6 +250,12 @@ namespace Coffee.UIEffects.Editors
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_samplingIntensity);
if (_samplingFilter.intValue == (int)SamplingFilter.EdgeAlpha
|| _samplingFilter.intValue == (int)SamplingFilter.EdgeLuminance)
{
EditorGUILayout.PropertyField(_samplingWidth);
}
EditorGUI.indentLevel--;
}
@@ -158,19 +269,37 @@ namespace Coffee.UIEffects.Editors
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, EditorGUIUtility.TrTempContent("Rotation"));
EditorGUILayout.PropertyField(_transitionKeepAspectRatio,
EditorGUIUtility.TrTempContent("Keep Aspect Ratio"));
EditorGUILayout.PropertyField(_transitionReverse, EditorGUIUtility.TrTempContent("Reverse"));
EditorGUI.indentLevel--;
if (2 < _transitionFilter.intValue)
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);
prevColorFilter = (ColorFilter)_transitionColorFilter.intValue;
EditorGUILayout.PropertyField(_transitionColorFilter);
DrawColor(_transitionColorFilter, _transitionColor, prevColorFilter);
DrawColor(_transitionColorFilter, _transitionColor, _transitionColorGlow);
}
EditorGUILayout.PropertyField(_transitionAutoPlaySpeed);
if (0 < _transitionFilter.intValue && !Mathf.Approximately(0, _transitionAutoPlaySpeed.floatValue))
{
EditorApplication.QueuePlayerLoopUpdate();
}
EditorGUI.indentLevel--;
@@ -192,7 +321,6 @@ namespace Coffee.UIEffects.Editors
if (!DrawHeaderPopup(_blendType))
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_srcBlendMode);
EditorGUILayout.PropertyField(_dstBlendMode);
EditorGUI.indentLevel--;
@@ -215,6 +343,7 @@ namespace Coffee.UIEffects.Editors
EditorGUILayout.Slider(_shadowDistanceX, 0, 1, "Reflection");
EditorGUILayout.PropertyField(_shadowDistanceY, EditorGUIUtility.TrTempContent("Offset"));
EditorGUILayout.PropertyField(_shadowMirrorScale);
EditorGUILayout.PropertyField(_shadowFade);
}
else
{
@@ -226,20 +355,192 @@ namespace Coffee.UIEffects.Editors
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;
}
EditorGUILayout.PropertyField(_shadowFade);
EditorGUILayout.PropertyField(_shadowEffectOnOrigin);
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, _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);
}
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, EditorGUIUtility.TrTempContent("Rotation"));
EditorGUILayout.PropertyField(_transitionKeepAspectRatio,
EditorGUIUtility.TrTempContent("Keep Aspect Ratio"));
EditorGUI.indentLevel--;
EditorGUI.indentLevel--;
}
DrawSeparator();
expandOthers = EditorGUILayout.BeginFoldoutHeaderGroup(expandOthers, "Others");
if (expandOthers)
{
EditorGUILayout.PropertyField(_samplingScale);
EditorGUILayout.PropertyField(_allowToModifyMeshShape);
EditorGUILayout.PropertyField(_customRoot);
EditorGUILayout.PropertyField(_flip);
}
}
private static void DrawColor(SerializedProperty filter, SerializedProperty color, ColorFilter prevFilter)
private static void DrawColorPickerField(string label, SerializedProperty color1, SerializedProperty color2)
{
if (filter.intValue == (int)ColorFilter.None)
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;
}
else if (filter.intValue == (int)ColorFilter.HsvModifier)
}
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)
{
@@ -251,7 +552,7 @@ namespace Coffee.UIEffects.Editors
EditorGUILayout.Slider(color.FindPropertyRelative("b"), -1f, 1f, "Value");
EditorGUILayout.Slider(color.FindPropertyRelative("a"), 0, 1, "Alpha");
}
else if (filter.intValue == (int)ColorFilter.Contrast)
else if (filter == ColorFilter.Contrast)
{
if (prevFilter != ColorFilter.Contrast)
{
@@ -269,7 +570,33 @@ namespace Coffee.UIEffects.Editors
color.colorValue = Color.white;
}
EditorGUILayout.PropertyField(color);
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);
}
}
@@ -290,30 +617,83 @@ namespace Coffee.UIEffects.Editors
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"))
{
UIEffectProjectSettings.SaveAsNewPreset(targets.OfType<UIEffect>().FirstOrDefault());
EditorApplication.delayCall += () =>
{
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"))
{
Array.ForEach(targets.OfType<UIEffect>().ToArray(), Unsupported.SmartReset);
}
}
public static void DropDownPreset(Rect r, Predicate<(string path, bool builtin, UIEffect preset)> valid,
Action<UIEffect> callback)
{
var menu = new GenericMenu();
var separatorAdded = false;
foreach (var preset in UIEffectProjectSettings.LoadEditorPresets())
{
var (path, builtin) = UIEffectProjectSettings.GetPresetPath(preset);
if (valid != null && valid.Invoke((path, builtin, preset)) == false) continue;
if (builtin)
{
if (!separatorAdded)
{
separatorAdded = true;
menu.AddSeparator(string.Empty);
}
path = path.Substring(6).Replace(" - ", "/");
}
menu.AddItem(new GUIContent(path), false, x => callback(x as UIEffect), preset);
}
menu.DropDown(r);
}
}
}
@@ -1,8 +1,6 @@
using UnityEditor;
using UnityEngine;
using System;
using System.Collections.Generic;
using System.Reflection;
using Coffee.UIEffectInternal;
using UnityEditorInternal;
namespace Coffee.UIEffects.Editors
@@ -11,17 +9,17 @@ namespace Coffee.UIEffects.Editors
public class UIEffectProjectSettingsEditor : Editor
{
private ReorderableList _reorderableList;
private SerializedProperty _fallbackVariantBehaviour;
private SerializedProperty _useHDRColorPicker;
private SerializedProperty _transformSensitivity;
private Editor _editor;
private bool _isInitialized;
private ShaderVariantRegistryEditor _shaderVariantRegistryEditor;
private void InitializeIfNeeded()
{
if (_isInitialized) return;
_fallbackVariantBehaviour = serializedObject.FindProperty("m_FallbackVariantBehaviour");
_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);
_reorderableList.drawHeaderCallback = rect => EditorGUI.LabelField(rect, "Runtime Presets");
@@ -38,34 +36,16 @@ 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 => !x.builtin && !UIEffectProjectSettings.instance.m_RuntimePresets.Contains(x.preset),
UIEffectProjectSettings.RegisterRuntimePreset);
};
var collection = serializedObject.FindProperty("m_ShaderVariantCollection").objectReferenceValue;
_editor = CreateEditor(collection);
_isInitialized = true;
}
private void OnDisable()
{
if (_editor)
{
DestroyImmediate(_editor);
}
_editor = null;
_isInitialized = false;
}
@@ -75,89 +55,34 @@ namespace Coffee.UIEffects.Editors
InitializeIfNeeded();
// Settings
// Transform sensitivity.
EditorGUILayout.PropertyField(_transformSensitivity);
// Runtime Presets
_reorderableList.DoLayoutList();
// Editor
EditorGUILayout.PropertyField(_fallbackVariantBehaviour);
serializedObject.ApplyModifiedProperties();
// Use HDR color pickers.
EditorGUILayout.PropertyField(_useHDRColorPicker);
// Shader
EditorGUILayout.Space(20);
EditorGUILayout.LabelField("Shader Variants", EditorStyles.boldLabel);
EditorGUILayout.Space(-12);
DrawUnregisteredShaderVariants(UIEffectProjectSettings.instance.m_UnregisteredShaderVariants);
DrawRegisteredShaderVariants(_editor);
// Shader registry
EditorGUILayout.Space();
EditorGUILayout.LabelField("Shader", EditorStyles.boldLabel);
if (_shaderVariantRegistryEditor == null)
{
var property = serializedObject.FindProperty("m_ShaderVariantRegistry");
_shaderVariantRegistryEditor = new ShaderVariantRegistryEditor(property, "(UIEffect)",
() =>
{
UIEffectProjectSettings.shaderRegistry
.RegisterOptionalShaders(UIEffectProjectSettings.instance);
});
}
_shaderVariantRegistryEditor.Draw();
GUILayout.FlexibleSpace();
serializedObject.ApplyModifiedProperties();
}
private static void DrawUnregisteredShaderVariants(List<string> variants)
{
if (variants.Count == 0) return;
EditorGUILayout.Space();
var array = variants.ToArray();
var r = EditorGUILayout.GetControlRect(false, 20);
var rLabel = new Rect(r.x, r.y, r.width - 80, r.height);
EditorGUI.LabelField(rLabel, "Registered Shader Variants");
var rButtonClear = new Rect(r.x + r.width - 80, r.y + 2, 80, r.height - 4);
if (GUI.Button(rButtonClear, "Clear All", EditorStyles.miniButton))
{
UIEffectProjectSettings.ClearUnregisteredShaderVariants();
}
EditorGUILayout.BeginVertical("RL Background");
for (var i = 0; i < array.Length; i++)
{
var values = array[i].Split(';');
r = EditorGUILayout.GetControlRect();
var rShader = new Rect(r.x, r.y, 150, r.height);
EditorGUI.ObjectField(rShader, Shader.Find(values[0]), typeof(Shader), false);
var rKeywords = new Rect(r.x + 150, r.y, r.width - 150 - 20, r.height);
EditorGUI.TextField(rKeywords, values[1]);
var rButton = new Rect(r.x + r.width - 20 + 2, r.y, 20, r.height);
if (GUI.Button(rButton, EditorGUIUtility.IconContent("icons/toolbar plus.png"), "iconbutton"))
{
UIEffectProjectSettings.RegisterVariant(array[i]);
}
}
EditorGUILayout.EndVertical();
}
private static void DrawRegisteredShaderVariants(Editor editor)
{
var collection = editor.target as ShaderVariantCollection;
if (collection == null) return;
EditorGUILayout.Space();
var r = EditorGUILayout.GetControlRect(false, 20);
var rLabel = new Rect(r.x, r.y, r.width - 80, r.height);
EditorGUI.LabelField(rLabel, "Registered Shader Variants");
var rButton = new Rect(r.x + r.width - 80, r.y + 2, 80, r.height - 4);
if (GUI.Button(rButton, "Clear All", EditorStyles.miniButton))
{
collection.Clear();
}
EditorGUILayout.BeginVertical("RL Background");
editor.serializedObject.Update();
var shaders = editor.serializedObject.FindProperty("m_Shaders");
for (var i = 0; i < shaders.arraySize; i++)
{
s_MiDrawShaderEntry.Invoke(editor, new object[] { i });
}
editor.serializedObject.ApplyModifiedProperties();
EditorGUILayout.EndVertical();
}
private static readonly MethodInfo s_MiDrawShaderEntry =
Type.GetType("UnityEditor.ShaderVariantCollectionInspector, UnityEditor")
?.GetMethod("DrawShaderEntry", BindingFlags.NonPublic | BindingFlags.Instance);
}
}
+43 -2
View File
@@ -1,4 +1,5 @@
using UnityEditor;
using UnityEngine;
namespace Coffee.UIEffects.Editors
{
@@ -11,26 +12,66 @@ namespace Coffee.UIEffects.Editors
{
private SerializedProperty _target;
private SerializedProperty _useTargetTransform;
private SerializedProperty _samplingScale;
private SerializedProperty _allowToModifyMeshShape;
private SerializedProperty _flip;
private SerializedProperty _customRoot;
private Editor _uiEffectEditor;
private void OnEnable()
{
_target = serializedObject.FindProperty("m_Target");
_useTargetTransform = serializedObject.FindProperty("m_UseTargetTransform");
_samplingScale = serializedObject.FindProperty("m_SamplingScale");
_allowToModifyMeshShape = serializedObject.FindProperty("m_AllowToModifyMeshShape");
_flip = serializedObject.FindProperty("m_Flip");
_customRoot = serializedObject.FindProperty("m_CustomRoot");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(_target);
var r = EditorGUILayout.GetControlRect();
r.width -= 60;
EditorGUI.PropertyField(r, _target);
// Preset button.
r.x += r.width;
r.width = 60;
if (GUI.Button(r, EditorGUIUtility.TrTempContent("Preset"), "MiniPopup"))
{
UIEffectEditor.DropDownPreset(r, x => !x.builtin, p =>
{
_target.objectReferenceValue = p;
_target.serializedObject.ApplyModifiedProperties();
});
}
// Preset mode warning.
if (_target.objectReferenceValue is UIEffect targetEffect && !targetEffect.gameObject.scene.IsValid())
{
r = EditorGUILayout.GetControlRect();
r.width -= EditorGUIUtility.labelWidth;
r.x += EditorGUIUtility.labelWidth;
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);
EditorGUILayout.PropertyField(_flip);
if (_target.objectReferenceValue)
{
EditorGUI.BeginDisabledGroup(true);
CreateCachedEditor(_target.objectReferenceValue, null, ref _uiEffectEditor);
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
(_uiEffectEditor as UIEffect2Editor)?.DrawProperties();
(_uiEffectEditor as UIEffectEditor)?.DrawProperties();
EditorGUILayout.EndVertical();
EditorGUI.EndDisabledGroup();
}
+134 -64
View File
@@ -1,4 +1,5 @@
using UnityEditor;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.Profiling;
@@ -6,44 +7,82 @@ namespace Coffee.UIEffects.Editors
{
[CanEditMultipleObjects]
[CustomEditor(typeof(UIEffectTweener))]
internal class UIMaterialPropertyTweenerEditor : Editor
internal class UIEffectTweenerEditor : Editor
{
private SerializedProperty _cullingMask;
private SerializedProperty _direction;
private SerializedProperty _curve;
private SerializedProperty _separateReverseCurve;
private SerializedProperty _reverseCurve;
private SerializedProperty _delay;
private SerializedProperty _duration;
private SerializedProperty _interval;
private SerializedProperty _restartOnEnable;
private SerializedProperty _playOnEnable;
private SerializedProperty _resetTimeOnEnable;
private SerializedProperty _updateMode;
private SerializedProperty _wrapMode;
private SerializedProperty _onComplete;
private SerializedProperty _onChangedRate;
private bool _isPlaying = false;
private double _lastTime;
private void OnEnable()
{
_cullingMask = serializedObject.FindProperty("m_CullingMask");
_direction = serializedObject.FindProperty("m_Direction");
_curve = serializedObject.FindProperty("m_Curve");
_restartOnEnable = serializedObject.FindProperty("m_RestartOnEnable");
_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");
_duration = serializedObject.FindProperty("m_Duration");
_interval = serializedObject.FindProperty("m_Interval");
_wrapMode = serializedObject.FindProperty("m_WrapMode");
_updateMode = serializedObject.FindProperty("m_UpdateMode");
_onComplete = serializedObject.FindProperty("m_OnComplete");
_onChangedRate = serializedObject.FindProperty("m_OnChangedRate");
EditorApplication.update += UpdateTweeners;
}
private void OnDisable()
{
EditorApplication.update -= UpdateTweeners;
}
public override void OnInspectorGUI()
{
Profiler.BeginSample("(MPI)[MPTweenerEditor] OnInspectorGUI");
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);
EditorGUILayout.PropertyField(_restartOnEnable);
EditorGUILayout.PropertyField(_playOnEnable);
EditorGUILayout.PropertyField(_resetTimeOnEnable);
EditorGUILayout.PropertyField(_wrapMode);
EditorGUILayout.PropertyField(_updateMode);
EditorGUILayout.PropertyField(_onComplete);
serializedObject.ApplyModifiedProperties();
DrawPlayer(target as UIEffectTweener);
Profiler.EndSample();
@@ -53,74 +92,62 @@ namespace Coffee.UIEffects.Editors
{
if (!tweener) return;
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginDisabledGroup(!Application.isPlaying);
var icon = EditorGUIUtility.IconContent("icons/playbutton.png");
var r = EditorGUILayout.GetControlRect(false);
EditorGUILayout.Space(4);
GUILayout.Label(GUIContent.none, "sv_iconselector_sep", GUILayout.ExpandWidth(true));
var rButton = new Rect(r.x, r.y, 20, r.height);
if (GUI.Button(rButton, icon, "IconButton"))
EditorGUILayout.BeginHorizontal();
var r = EditorGUILayout.GetControlRect(false);
var rResetTimeButton = new Rect(r.x, r.y, 20, r.height);
if (GUI.Button(rResetTimeButton, EditorGUIUtility.IconContent("animation.firstkey"), "IconButton"))
{
tweener.SetTime(0);
ResetTime();
}
EditorGUI.EndDisabledGroup();
var rPlayButton = new Rect(r.x + 20, r.y, 20, r.height);
if (GUI.Button(rPlayButton, EditorGUIUtility.IconContent("playbutton"), "IconButton"))
{
SetPlaying(true);
}
var rPauseButton = new Rect(r.x + 40, r.y, 20, r.height);
if (GUI.Button(rPauseButton, EditorGUIUtility.IconContent("pausebutton"), "IconButton"))
{
SetPlaying(false);
}
var totalTime = tweener.totalTime;
var time = tweener.time;
var label = EditorGUIUtility.TrTempContent($"{time:N2}/{totalTime:N2}");
var wLabel = Mathf.CeilToInt(EditorStyles.label.CalcSize(label).x / 5f) * 5f;
wLabel = 80;
var rLabel = new Rect(r.x + r.width - wLabel, r.y, wLabel, r.height);
var rLabel = new Rect(r.x + r.width - 80, r.y, 80, r.height);
GUI.Label(rLabel, label, "RightLabel");
EditorGUILayout.EndHorizontal();
EditorGUI.BeginChangeCheck();
var rSlider = new Rect(r.x + 20, r.y, r.width - wLabel - 20, r.height);
var rSlider = new Rect(r.x + 60, r.y, r.width - 140, r.height);
var r0 = new Rect(rSlider.x, rSlider.y + 4, rSlider.width, rSlider.height - 8);
r0.x += DrawBackground(r0, rSlider.width * tweener.delay / totalTime, Color.blue);
r0.x += DrawBackground(r0, rSlider.width * tweener.duration / totalTime, Color.green);
//
var
r0 = rSlider; //new Rect(rSlider.x, rSlider.y, rSlider.width * tweener.interval / totalTime, rSlider.height);
r0.y += 4;
r0.height -= 8;
r0.width = rSlider.width * tweener.delay / totalTime;
GUI.color = Color.blue;
GUI.Label(r0, GUIContent.none, "TE DefaultTime");
r0.x += r0.width;
r0.width = rSlider.width * tweener.duration / totalTime;
GUI.color = Color.green;
GUI.Label(r0, GUIContent.none, "TE DefaultTime");
r0.x += r0.width;
r0.width = rSlider.width * tweener.interval / totalTime;
GUI.color = Color.red;
GUI.Label(r0, GUIContent.none, "TE DefaultTime");
if (UIEffectTweener.WrapMode.Loop <= tweener.wrapMode)
{
r0.x += DrawBackground(r0, rSlider.width * tweener.interval / totalTime, Color.red);
}
if (UIEffectTweener.WrapMode.PingPongOnce <= tweener.wrapMode)
{
r0.x += r0.width;
r0.width = rSlider.width * tweener.duration / totalTime;
GUI.color = Color.green;
GUI.Label(r0, GUIContent.none, "TE DefaultTime");
r0.x += DrawBackground(r0, rSlider.width * tweener.duration / totalTime, Color.green);
}
if (UIEffectTweener.WrapMode.PingPongLoop <= tweener.wrapMode)
{
r0.x += r0.width;
r0.width = rSlider.width * tweener.interval / totalTime;
GUI.color = Color.red;
GUI.Label(r0, GUIContent.none, "TE DefaultTime");
r0.x += DrawBackground(r0, rSlider.width * tweener.interval / totalTime, Color.red);
}
GUI.color = Color.white;
time = GUI.HorizontalSlider(rSlider, time, 0, totalTime);
if (EditorGUI.EndChangeCheck())
{
tweener.SetTime(time);
SetTime(time);
}
if (Application.isPlaying && tweener.isActiveAndEnabled)
@@ -129,21 +156,64 @@ namespace Coffee.UIEffects.Editors
}
}
// private static void PostAddElement(SerializedProperty prop, string propertyName)
// {
// prop.FindPropertyRelative("m_From.m_Type").intValue = -1;
// prop.FindPropertyRelative("m_From.m_PropertyName").stringValue = propertyName;
// prop.FindPropertyRelative("m_To.m_Type").intValue = -1;
// prop.FindPropertyRelative("m_To.m_PropertyName").stringValue = propertyName;
// }
//
// private void ResetCallback()
// {
// var current = serializedObject.targetObject as UIEffectTweener;
// if (!current) return;
//
// Undo.RecordObject(current, "Reset Values");
// current.ResetPropertiesToDefault();
// }
private static float DrawBackground(Rect r, float width, Color color)
{
r.width = width;
GUI.color = color;
GUI.Label(r, GUIContent.none, "TE DefaultTime");
return width;
}
private void SetTime(float time)
{
foreach (var tweener in targets.OfType<UIEffectTweener>())
{
tweener.SetTime(time);
}
}
private void ResetTime()
{
foreach (var tweener in targets.OfType<UIEffectTweener>())
{
tweener.ResetTime(tweener.direction);
}
}
private void SetPlaying(bool enable)
{
if (!EditorApplication.isPlaying)
{
_isPlaying = enable;
_lastTime = EditorApplication.timeSinceStartup;
return;
}
foreach (var tweener in targets.OfType<UIEffectTweener>())
{
if (enable)
{
tweener.Play(false);
}
else
{
tweener.SetPause(true);
}
}
}
private void UpdateTweeners()
{
if (!_isPlaying || EditorApplication.isPlayingOrWillChangePlaymode) return;
var delta = (float)(EditorApplication.timeSinceStartup - _lastTime);
_lastTime = EditorApplication.timeSinceStartup;
foreach (var tweener in targets.OfType<UIEffectTweener>())
{
tweener.UpdateTime(tweener.direction == UIEffectTweener.Direction.Forward ? delta : -delta);
}
EditorApplication.QueuePlayerLoopUpdate();
}
}
}
+284 -47
View File
@@ -19,8 +19,8 @@
## 📝 Description <!-- omit in toc -->
**_"Decorate your uGUI, simply and powerfully."_**
UIEffect is an open-source package that allows you to intuitively apply rich UI effects directly from the Inspector or via code.
**_"Decorate your UI, simply and powerfully."_**
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)
@@ -32,7 +32,7 @@ Combine various filters, such as grayscale, blur, and dissolve, to decorate your
- [Install via UPM (with Package Manager UI)](#install-via-upm-with-package-manager-ui)
- [Install via UPM (Manually)](#install-via-upm-manually)
- [Install as Embedded Package](#install-as-embedded-package)
- [Additional Resource Imports](#additional-resource-imports)
- [Import Additional Resources](#import-additional-resources)
- [🔄 Upgrading from v4 to v5](#-upgrading-from-v4-to-v5)
- [🚀 Usage](#-usage)
- [Getting Started](#getting-started)
@@ -40,6 +40,7 @@ Combine various filters, such as grayscale, blur, and dissolve, to decorate your
- [Component: UIEffectTweener](#component-uieffecttweener)
- [Component: UIEffectReplica](#component-uieffectreplica)
- [Usage with TextMeshPro](#usage-with-textmeshpro)
- [Usage with SoftMaskForUGUI](#usage-with-softmaskforugui)
- [Runtime/Editor Preset for UIEffect](#runtimeeditor-preset-for-uieffect)
- [Usage with Code](#usage-with-code)
- [Project Settings](#project-settings)
@@ -56,7 +57,7 @@ Combine various filters, such as grayscale, blur, and dissolve, to decorate your
## 📌 Key Features
![](https://github.com/user-attachments/assets/eab596e5-6cae-4441-b02b-7fc1fb45743d)
![](https://github.com/user-attachments/assets/e5112713-166d-451f-8090-501e6ea156ca)
- **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.
@@ -73,8 +74,10 @@ Combine various filters, such as grayscale, blur, and dissolve, to decorate your
## 🎮 Demo
![](https://github.com/user-attachments/assets/17e5ee27-f7d5-43aa-942f-182e2b4c838c)
![](https://github.com/user-attachments/assets/02ab1686-03d4-4500-bd89-004b2c401441)
![](https://github.com/user-attachments/assets/ed38d668-4963-46c5-a1a1-cff33ab278ed)
![](https://github.com/user-attachments/assets/9cf575ad-88e2-4bcc-9a44-9931a4d5c589)
![](https://github.com/user-attachments/assets/1ed410bf-b782-433b-9429-721278c5ba1e)
![](https://github.com/user-attachments/assets/f9271346-fc4e-4c05-a1a8-88cf36110c05)
[WebGL Demo](https://mob-sakai.github.io/UIEffect/)
@@ -86,7 +89,7 @@ _This package requires **Unity 2020.3 or later**._
### Install via OpenUPM
- This package is available on [OpenUPM](https://openupm.com) package registry.
- This package is available on [OpenUPM](https://openupm.com/packages/com.coffee.ui-effect/) package registry.
- This is the preferred method of installation, as you can easily receive updates as they're released.
- If you have [openupm-cli](https://github.com/openupm/openupm-cli) installed, then run the following command in your project's directory:
```
@@ -94,7 +97,7 @@ _This package requires **Unity 2020.3 or later**._
```
- To update the package, use Package Manager UI (`Window > Package Manager`) or run the following command with `@{version}`:
```
openupm add com.coffee.ui-effect@5.0.0
openupm add com.coffee.ui-effect@5.6.0
```
### Install via UPM (with Package Manager UI)
@@ -103,7 +106,7 @@ _This package requires **Unity 2020.3 or later**._
- Click `+ > Add package from git URL...` and input the repository URL: `https://github.com/mob-sakai/UIEffect.git?path=Packages/src`
![](https://github.com/user-attachments/assets/f88f47ad-c606-44bd-9e86-ee3f72eac548)
- To update the package, change suffix `#{version}` to the target version.
- e.g. `https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.0.0`
- e.g. `https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.6.0`
### Install via UPM (Manually)
@@ -118,20 +121,21 @@ _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.0.0",`
- e.g. `"com.coffee.ui-effect": "https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.6.0",`
### Install as Embedded Package
1. Download a source code zip file from [Releases](https://github.com/mob-sakai/UIEffect/releases) and extract it.
2. Place `<extracted_dir>/Packages/src` directory in your project's `Packages` directory.
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)
- You can rename the `src` directory.
- If you want to fix bugs or add features, install it as an embedded package.
- To update the package, you need to re-download it and replace the contents.
- You can rename the `src` directory if needed.
- If you intend to fix bugs or add features, installing it as an embedded package is recommended.
- To update the package, re-download it and replace the existing contents.
### Additional Resource Imports
### Import Additional Resources
UIEffect includes additional resources to import.
Additional resources can be imported to extend functionality.
- [🔄 Upgrading from v4 to v5](#-upgrading-from-v4-to-v5)
- [Usage with TextMeshPro](#usage-with-textmeshpro)
@@ -150,6 +154,7 @@ 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.
@@ -158,7 +163,7 @@ If upgrading from UIEffect v4 to v5, note the following breaking changes:
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)
@@ -182,71 +187,253 @@ If upgrading from UIEffect v4 to v5, note the following breaking changes:
### Component: UIEffect
![](https://github.com/user-attachments/assets/090a71ea-81b4-4264-852c-af03f9346dd3)
The `UIEffect` component applies visual effects to UI elements, allowing various effects to be achieved by combining multiple filters.
- **Tone Filter**: `None`, `Grayscale`, `Sepia`, `Nega`, `Retro`, `Posterize`
![](https://github.com/user-attachments/assets/f32f4735-5d49-4f12-a79d-1b05e819868e)
> [!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
![](https://github.com/user-attachments/assets/152f7bd2-f3d6-4dcc-8c34-58f94b1a1f47)
- **Tone Filter**: `None`, `Grayscale`, `Sepia`, `Nega`, `Retro`, `Posterize`
![](https://github.com/user-attachments/assets/e80d9047-f9c9-45b4-90d9-03cd33e2a0ec)
- **Tone Intensity**: 0.0 (no effect) - 1.0 (full effect).
- **Color Filter**: `None`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `Multiply Luminance`, `Multiply Additive`, `Hsv Modifier`, `Contrast`
<br>
#### Color Filter
![](https://github.com/user-attachments/assets/b2bde449-f45d-4174-917f-bab8ea8bdf12)
- **Color Filter**: `None`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `Multiply Luminance`, `Multiply Additive`, `Hsv Modifier`, `Contrast`
![](https://github.com/user-attachments/assets/4685581d-ec0a-4ce3-9627-919fb7ffdca6)
- **Color Intensity**: 0.0 (no effect) - 1.0 (full effect).
- **Sampling Filter**: `None`, `Blur Fast`, `Blur Medium`, `Blur Detail`, `Pixelation`, `Rgb Shift`, `Edge Luminescence`, `Edge Alpha`
- **Color Glow**: Set the color to glow.
<br>
#### Sampling Filter
![](https://github.com/user-attachments/assets/fb4fa1d2-cf29-43de-9321-96f6355f45e9)
- **Sampling Filter**: `None`, `Blur Fast`, `Blur Medium`, `Blur Detail`, `Pixelation`, `Rgb Shift`, `Edge Luminescence`, `Edge Alpha`
![](https://github.com/user-attachments/assets/d2a07673-8fd5-489d-94d4-49907122623f)
- **Sampling Intensity**: 0.0 (no effect) - 1.0 (full effect).
- **Transition Filter**: `None`, `Fade`, `Cutoff`, `Dissolve`, `Shiny`, `Mask`, `Melt`, `Burn`
- **Sampling Width**: The width of the sampling effect.
<br>
#### Transition Filter
![](https://github.com/user-attachments/assets/9e75421a-c7cc-4be9-b38e-3a5914c02ef8)
- **Transition Filter**: `None`, `Fade`, `Cutoff`, `Dissolve`, `Shiny`, `Mask`, `Melt`, `Burn`, `Pattern`
![](https://github.com/user-attachments/assets/26942df8-47fa-4961-8949-c3290bd4f442)
- **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` and `Keep Aspect Ratio` are shared with `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/Transition Color**: Specifies the transition color.
- **Target Mode**: `None`, `Hue`, `Luminance`
- **Transition Color Filter**: Specifies the transition color.
- **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 (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/user-attachments/assets/e70ec77d-5417-4ee9-b055-a7f870b06e23)
<br>
#### Target Mode
![](https://github.com/user-attachments/assets/19cf9641-42c8-423e-84f7-e6b24243c2f3)
- **Target Mode**: `None`, `Hue`, `Luminance`
![](https://github.com/user-attachments/assets/7493ed9c-f1f5-4532-8266-067a3a316f5d)
- 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.
- **Blend Type**: `Alpha Blend`, `Multiply`, `Additive`, `Soft Additive`, `Multiply Additive`, `Custom (SrcBlend, DstBlend)`
- **Shadow Mode**: `None`, `Shadow`, `Shadow3`, `Outline`, `Outline8`, `Mirror`
<br>
#### Blend Type
![](https://github.com/user-attachments/assets/5ffcf33e-4c54-450f-a8e1-db0cf3353dda)
- **Blend Type**: `Alpha Blend`, `Multiply`, `Additive`, `Soft Additive`, `Multiply Additive`, `Custom`
![](https://github.com/user-attachments/assets/406e3aa7-0afa-48e5-aac2-73c0f3483c5c)
- `Custom` blend type can be set using the `SrcBlend` and `DstBlend` properties.
<br>
#### Shadow Mode
![](https://github.com/user-attachments/assets/f6b78a66-5944-465a-b716-be19cb1aa140)
- **Shadow Mode**: `None`, `Shadow`, `Shadow3`, `Outline`, `Outline8`, `Mirror`
![](https://github.com/user-attachments/assets/fc8d0fb1-63ce-4a6b-b278-353a7a210369)
- **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**: The color of the shadow.
- **Shadow Color Glow**: Set the shadow color to glow.
- **Shadow Fade**: Alpha value of the shadow or outline.
- **Shadow Effect On Origin**: Applies effects to meshes other than shadows.
- **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.
<br>
#### Gradation Mode
![](https://github.com/user-attachments/assets/1ce4a90e-90e2-4674-8c2b-9cfda33acb84)
- **Gradation Mode**: `None`, `Horizontal`, `HorizontalGradient`, `Vertical`, `VerticalGradient`, `RadialFast`, `RadialDetail`, `Diagonal`, `DiagonalToRightBottom`, `DiagonalToLeftBottom`, `Angle`, `AngleGradient`
![](https://github.com/user-attachments/assets/fd2791db-5740-4030-aec0-4bae90fc2b30)
- **Gradation Gradient**: The gradient of the gradation.
- **Gradation Color 1**: The first color of the gradation.
- **Gradation Color 2**: The second color of the gradation.
- **Gradation Offset**: The offset of the gradation range.
- **Gradation Scale**: The scale of the gradation range.
- **Gradation Rotation**: The rotation of the gradation range (`Angle` or `AngleGradient`).
> [!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
![](https://github.com/user-attachments/assets/361a650d-18a4-4fc7-966d-4c87b765be54)
- **Edge Mode**: `None`, `Plain`, `Shiny`
![](https://github.com/user-attachments/assets/ec7b0e25-f89a-4b3d-8e97-eca88d26b5e2)
- **Edge Width**: The width of the edge.
- **Edge Color Filter**: Specifies the edge color.
- **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 (using shader side `_Time`).
<br>
#### Detail Filter
![](https://github.com/user-attachments/assets/295d7d2d-be6e-4104-9ea3-e5208902a3d2)
- **Detail Filter**: `None`, `Masking`, `Multiply`, `Additive`, `Replace`, `MuliplyAdditive`
![](https://github.com/user-attachments/assets/73933788-4179-4d8d-9b07-446d0a998227)
- **Detail Intensity**: 0.0 (no effect) - 1.0 (full effect).
- **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` and `Keep Aspect Ratio` are shared with `Transition Filter`.
<br>
#### Others
![](https://github.com/user-attachments/assets/d0394c3b-34a0-4998-987a-192f9a848cdc)
- **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.
- **Flip**:
- `Nothing`
- `Horizontal`
- `Vertical`
- `Effect`: Flip with the effect.
- `Shadow`: Flip with the shadow.
> [!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.
<br><br>
### Component: UIEffectTweener
![](https://github.com/user-attachments/assets/7b02f029-c9d4-4e00-aad7-240f893af775)
![](https://github.com/user-attachments/assets/64ff1e78-d06e-461f-80a5-3b3e9f615496)
The `UIEffectTweener` component animates the effect, enabling easy control over effect animations without the need for an `AnimationClip`.
- **Culling Mask**: `Tone`, `Color`, `Sampling`, `Transition`
- **Direction**: `Forward (0.0 -> 1.0)`, `Backward (1.0 -> 0.0)`
- **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.
- **Curve**: The curve of the animation.
- **Restart On Enable**: Play the animation automatically when the component is enabled.
- **Wrap Mode**: `Once`, `Loop`, `PingPongOnce`, `PingPongLoop`
- **Play On Enable**: `None`, `Forward`, `Reverse`, `Keep Direction`
- 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`: 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.
You can preview the animation using the seek bar and play button.
<br><br>
### Component: UIEffectReplica
![](https://github.com/user-attachments/assets/a1fad455-de60-4a18-b587-1ae138af1d37)
![](https://github.com/user-attachments/assets/458ab704-90b1-473d-8bda-80c325e1654e)
The `UIEffectReplica` component applies visual effects to UI elements by replicating the settings of another `UIEffect` component. This allows the same effect to be applied across multiple UI elements simultaneously.
- **Target**: The target `UIEffect` component to replicate.
> [!TIP]
> You can specify a preset as well as an instance as the target for `UIEffectReplica`.
- **Use Target Transform**: Use the target's transform for some effects.
![](https://github.com/user-attachments/assets/127e30fb-15c7-4002-ab65-e8f29e640330)
- **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.
- **Flip**:
- `Nothing`
- `Horizontal`
- `Vertical`
- `Effect`: Flip the effect.
- `Shadow`: Flip the shadow.
<br><br>
### Usage with TextMeshPro
![](https://github.com/user-attachments/assets/bd12baa3-52f7-41e9-bf05-a052d0aabc37)
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.
UIEffect supports TextMeshProUGUI elements. To use UIEffect with TextMeshPro, follow these steps:
![](https://github.com/user-attachments/assets/78b262fc-1581-49f2-8c93-06d591b525c6)
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)
@@ -260,18 +447,45 @@ UIEffect supports TextMeshProUGUI elements. To use UIEffect with TextMeshPro, fo
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)
> [!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/user-attachments/assets/7701e765-896a-49a8-b1ed-22adb0ecce12)
[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.6.0+)`.
When a shader included in the samples is requested, an import dialog will automatically appear.
Click the `Import` button.
<br><br>
### Runtime/Editor Preset for UIEffect
![](https://github.com/user-attachments/assets/4244d162-a768-463e-8aad-8cafbdf3a5b3)
![](https://github.com/user-attachments/assets/f32f4735-5d49-4f12-a79d-1b05e819868e)
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.
> [!TIP]
> Editor presets are saved in the `UIEffectPresets` directory.
> You can also create subdirectories to customize the preset menu.
<br><br>
### Usage with Code
@@ -301,18 +515,39 @@ UIEffectProjectSettings.shaderVariantCollection.WarmUp();
### Project Settings
![](https://github.com/user-attachments/assets/33b01665-0893-4460-a220-62f5f08b2eec)
![](https://github.com/user-attachments/assets/c50ed6fc-9577-4c85-9b38-89ed8571a8b0)
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.
- **Fallback Variant Behavior**: Specifies the behavior when an unregistered shader variant is used in the editor.
- `Register Variant`: Adds the variant to `Registered Variants` for runtime use.
- `LogError`: Outputs a error and adds it to `Unregistered Variants`.
#### Editor
- **Use HDR Color Picker**: If enabled, the HDR color picker will be used in the inspector.
#### Shader
- **Optional Shaders (UIEffect)**: A list of shaders that will be prioritized when a ui-effect shader is
requested.
- If the shader is included in the list, that shader will be used.
- If it is not in the list, the following shaders will be used in order:
- If the shader name contains `(UIEffect)`, that shader will be used.
- If `Hidden/<shader_name> (UIEffect)` exists, that shader will be used.
- As a fallback, `UI/Default (UIEffect)` will be used.
- **Registered Variants**: A list of shader variants available at runtime. Use "-" button to remove unused variants,
reducing build time and file size.
- By default, the used ui-effect shaders will be included in the build. You can remove them if you don't need.
- **Unregistered Variants**: A list of shader variants that are not registered. Use "+" button to add variants.
- **Registered Variants**: A list of shader variants available at runtime. Use "-" button to remove unused variants, reducing build time and file size.
- **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>
@@ -323,6 +558,8 @@ Here are the limitations of UIEffect:
- Shader variants used at runtime must be registered in the [Project Settings](#project-settings).
- When using UIEffect with TextMeshProUGUI, `SamplingFilter.BlurMedium` and `SamplingFilter.BlurDetail` are not supported due to performance considerations.
- These will automatically fall back to `SamplingFilter.BlurFast`.
- UIEffect supports default UI components (`Image`, `RawImage`, `Text`) and `TextMeshProUGUI`.
- If you want to use UIEffect with other components, create a issue or pull request.
<br><br>
Binary file not shown.
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: a9c99c9c4ae6f4d4aa041ad31432e922
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
+53 -2
View File
@@ -1,4 +1,5 @@
using UnityEngine.Rendering;
using System;
using UnityEngine.Rendering;
namespace Coffee.UIEffects
{
@@ -46,7 +47,8 @@ namespace Coffee.UIEffects
Shiny = 4,
Mask = 5,
Melt = 6,
Burn = 7
Burn = 7,
Pattern = 8
}
public enum BlendType
@@ -76,6 +78,55 @@ namespace Coffee.UIEffects
Mirror
}
public enum EdgeMode
{
None = 0,
Plain,
Shiny
}
public enum PatternArea
{
All = 0,
Inner = 1,
Edge = 2
}
public enum GradationMode
{
None = 0,
Horizontal = 1,
HorizontalGradient = 2,
Vertical = 3,
VerticalGradient = 4,
RadialFast = 5,
RadialDetail = 6,
Diagonal = 11,
DiagonalToRightBottom = 7,
DiagonalToLeftBottom = 8,
Angle = 9,
AngleGradient = 10
}
public enum DetailFilter
{
None = 0,
Masking = 1,
Multiply = 2,
Additive = 3,
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)
@@ -18,10 +18,10 @@ namespace Coffee.UIEffectInternal
public static T[] GetComponentsInChildren<T>(this Component self, int depth)
where T : Component
{
var results = ListPool<T>.Rent();
var results = InternalListPool<T>.Rent();
self.GetComponentsInChildren_Internal(results, depth);
var array = results.ToArray();
ListPool<T>.Return(ref results);
InternalListPool<T>.Return(ref results);
return array;
}
@@ -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))
{
@@ -5,7 +5,7 @@ namespace Coffee.UIEffectInternal
{
internal static class MeshExtensions
{
internal static readonly ObjectPool<Mesh> s_MeshPool = new ObjectPool<Mesh>(
internal static readonly InternalObjectPool<Mesh> s_MeshPool = new InternalObjectPool<Mesh>(
() =>
{
var mesh = new Mesh
@@ -38,10 +38,10 @@ namespace Coffee.UIEffectInternal
{
if (!self || !dst) return;
var vector3List = ListPool<Vector3>.Rent();
var vector4List = ListPool<Vector4>.Rent();
var color32List = ListPool<Color32>.Rent();
var intList = ListPool<int>.Rent();
var vector3List = InternalListPool<Vector3>.Rent();
var vector4List = InternalListPool<Vector4>.Rent();
var color32List = InternalListPool<Color32>.Rent();
var intList = InternalListPool<int>.Rent();
dst.Clear(false);
@@ -73,10 +73,10 @@ namespace Coffee.UIEffectInternal
dst.SetUVs(3, vector4List);
dst.RecalculateBounds();
ListPool<Vector3>.Return(ref vector3List);
ListPool<Vector4>.Return(ref vector4List);
ListPool<Color32>.Return(ref color32List);
ListPool<int>.Return(ref intList);
InternalListPool<Vector3>.Return(ref vector3List);
InternalListPool<Vector4>.Return(ref vector4List);
InternalListPool<Color32>.Return(ref color32List);
InternalListPool<int>.Return(ref intList);
}
public static void CopyTo(this Mesh self, VertexHelper dst)
@@ -92,13 +92,13 @@ namespace Coffee.UIEffectInternal
{
if (!self || dst == null) return;
var positions = ListPool<Vector3>.Rent();
var normals = ListPool<Vector3>.Rent();
var uv0 = ListPool<Vector4>.Rent();
var uv1 = ListPool<Vector4>.Rent();
var tangents = ListPool<Vector4>.Rent();
var colors = ListPool<Color32>.Rent();
var indices = ListPool<int>.Rent();
var positions = InternalListPool<Vector3>.Rent();
var normals = InternalListPool<Vector3>.Rent();
var uv0 = InternalListPool<Vector4>.Rent();
var uv1 = InternalListPool<Vector4>.Rent();
var tangents = InternalListPool<Vector4>.Rent();
var colors = InternalListPool<Color32>.Rent();
var indices = InternalListPool<int>.Rent();
self.GetVertices(positions);
self.GetColors(colors);
self.GetUVs(0, uv0);
@@ -118,13 +118,13 @@ namespace Coffee.UIEffectInternal
dst.AddTriangle(indices[i], indices[i + 1], indices[i + 2]);
}
ListPool<Vector3>.Return(ref positions);
ListPool<Vector3>.Return(ref normals);
ListPool<Vector4>.Return(ref uv0);
ListPool<Vector4>.Return(ref uv1);
ListPool<Vector4>.Return(ref tangents);
ListPool<Color32>.Return(ref colors);
ListPool<int>.Return(ref indices);
InternalListPool<Vector3>.Return(ref positions);
InternalListPool<Vector3>.Return(ref normals);
InternalListPool<Vector4>.Return(ref uv0);
InternalListPool<Vector4>.Return(ref uv1);
InternalListPool<Vector4>.Return(ref tangents);
InternalListPool<Color32>.Return(ref colors);
InternalListPool<int>.Return(ref indices);
}
}
}
@@ -1,144 +0,0 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;
namespace Coffee.UIEffectInternal
{
/// <summary>
/// Extension methods for Transform class.
/// </summary>
internal static class TransformExtensions
{
private const float k_DefaultEpsilon = 1f / (2 ^ 8);
private static readonly Vector3[] s_Corners = new Vector3[4];
/// <summary>
/// Compare the hierarchy index of one transform with another transform.
/// </summary>
public static int CompareHierarchyIndex(this Transform self, Transform other, Transform stopAt)
{
if (self == other) return 0;
Profiler.BeginSample("(COF)[TransformExt] CompareHierarchyIndex > GetTransforms");
var lTrs = self.GetTransforms(stopAt, ListPool<Transform>.Rent());
var rTrs = other.GetTransforms(stopAt, ListPool<Transform>.Rent());
Profiler.EndSample();
Profiler.BeginSample("(COF)[TransformExt] CompareHierarchyIndex > Calc");
var loop = Mathf.Max(lTrs.Count, rTrs.Count);
var result = 0;
for (var i = 0; i < loop; ++i)
{
var selfIndex = 0 <= lTrs.Count - i - 1 ? lTrs[lTrs.Count - i - 1].GetSiblingIndex() : -1;
var otherIndex = 0 <= rTrs.Count - i - 1 ? rTrs[rTrs.Count - i - 1].GetSiblingIndex() : -1;
if (selfIndex == otherIndex) continue;
result = selfIndex - otherIndex;
break;
}
Profiler.EndSample();
Profiler.BeginSample("(COF)[TransformExt] CompareHierarchyIndex > Return");
ListPool<Transform>.Return(ref lTrs);
ListPool<Transform>.Return(ref rTrs);
Profiler.EndSample();
return result;
}
private static List<Transform> GetTransforms(this Transform self, Transform stopAt, List<Transform> results)
{
results.Clear();
while (self != stopAt)
{
results.Add(self);
self = self.parent;
}
return results;
}
/// <summary>
/// Check if a transform has changed.
/// </summary>
public static bool HasChanged(this Transform self, ref Matrix4x4 prev, float epsilon = k_DefaultEpsilon)
{
return self.HasChanged(null, ref prev, epsilon);
}
/// <summary>
/// Check if a transform has changed.
/// </summary>
public static bool HasChanged(this Transform self, Transform baseTransform, ref Matrix4x4 prev,
float epsilon = k_DefaultEpsilon)
{
if (!self) return false;
var hash = baseTransform ? baseTransform.GetHashCode() : 0;
if (FrameCache.TryGet(self, nameof(HasChanged), hash, out bool result)) return result;
var matrix = baseTransform
? baseTransform.worldToLocalMatrix * self.localToWorldMatrix
: self.localToWorldMatrix;
var current = matrix * Matrix4x4.Scale(Vector3.one * 10000);
result = !Approximately(current, prev, epsilon);
FrameCache.Set(self, nameof(HasChanged), hash, result);
if (result)
{
prev = current;
}
return result;
}
private static bool Approximately(Matrix4x4 self, Matrix4x4 other, float epsilon = k_DefaultEpsilon)
{
for (var i = 0; i < 16; i++)
{
if (epsilon < Mathf.Abs(self[i] - other[i]))
{
return false;
}
}
return true;
}
public static Bounds GetRelativeBounds(this Transform self, Transform child)
{
if (!self || !child)
{
return new Bounds(Vector3.zero, Vector3.zero);
}
var list = ListPool<RectTransform>.Rent();
child.GetComponentsInChildren(false, list);
if (list.Count == 0)
{
ListPool<RectTransform>.Return(ref list);
return new Bounds(Vector3.zero, Vector3.zero);
}
var max = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
var min = new Vector3(float.MinValue, float.MinValue, float.MinValue);
var worldToLocalMatrix = self.worldToLocalMatrix;
for (var i = 0; i < list.Count; i++)
{
list[i].GetWorldCorners(s_Corners);
for (var j = 0; j < 4; j++)
{
var lhs = worldToLocalMatrix.MultiplyPoint3x4(s_Corners[j]);
max = Vector3.Min(lhs, max);
min = Vector3.Max(lhs, min);
}
}
ListPool<RectTransform>.Return(ref list);
var rectTransformBounds = new Bounds(max, Vector3.zero);
rectTransformBounds.Encapsulate(min);
return rectTransformBounds;
}
}
}
@@ -14,7 +14,7 @@ namespace Coffee.UIEffectInternal
public abstract class PreloadedProjectSettings : ScriptableObject
#if UNITY_EDITOR
{
private class MyAllPostprocessor : AssetPostprocessor
private class Postprocessor : AssetPostprocessor
{
private static void OnPostprocessAllAssets(string[] _, string[] __, string[] ___, string[] ____)
{
@@ -47,6 +47,11 @@ namespace Coffee.UIEffectInternal
{
SetDefaultSettings(defaultSettings);
}
if (defaultSettings)
{
defaultSettings.OnInitialize();
}
}
}
@@ -110,6 +115,10 @@ namespace Coffee.UIEffectInternal
protected virtual void OnCreateAsset()
{
}
protected virtual void OnInitialize()
{
}
}
#else
{
@@ -124,6 +133,8 @@ namespace Coffee.UIEffectInternal
#if UNITY_EDITOR
private string _jsonText;
public static bool hasInstance => s_Instance;
public static T instance
{
get
@@ -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:
@@ -10,8 +10,9 @@ namespace Coffee.UIEffectInternal
/// </summary>
internal class FastActionBase<T>
{
private static readonly ObjectPool<LinkedListNode<T>> s_NodePool =
new ObjectPool<LinkedListNode<T>>(() => new LinkedListNode<T>(default), _ => true, x => x.Value = default);
private static readonly InternalObjectPool<LinkedListNode<T>> s_NodePool =
new InternalObjectPool<LinkedListNode<T>>(() => new LinkedListNode<T>(default), _ => true,
x => x.Value = default);
private readonly LinkedList<T> _delegates = new LinkedList<T>();
@@ -15,7 +15,7 @@ namespace Coffee.UIEffectInternal
#if UNITY_EDITOR
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void Clear()
public static void Clear()
{
s_Repository.Clear();
}
@@ -0,0 +1,144 @@
using System;
using UnityEditor;
using UnityEngine;
namespace Coffee.UIEffectInternal
{
[Serializable]
public struct MinMax01
{
[SerializeField]
private float m_Min;
[SerializeField]
private float m_Max;
public MinMax01(float min, float max)
{
m_Min = Mathf.Clamp01(Mathf.Min(min, max));
m_Max = Mathf.Clamp01(Mathf.Max(min, max));
}
public float min
{
get => m_Min;
set
{
m_Min = Mathf.Clamp01(value);
m_Max = Mathf.Max(value, m_Max);
}
}
public float max
{
get => m_Max;
set
{
m_Max = Mathf.Clamp01(value);
m_Min = Mathf.Min(value, m_Min);
}
}
public float average => (m_Max + m_Min) * 0.5f;
public bool Approximately(MinMax01 other)
{
return Mathf.Approximately(m_Min, other.m_Min) && Mathf.Approximately(m_Max, other.m_Max);
}
}
#if UNITY_EDITOR
[CustomPropertyDrawer(typeof(MinMax01))]
public class MinMaxRangeDrawer : PropertyDrawer
{
private const float k_NumWidth = 50;
private const float k_Space = 5;
private SerializedProperty _max;
private SerializedProperty _min;
private static bool IsSingleLine(GUIContent label)
{
return EditorGUIUtility.wideMode || label == null || string.IsNullOrEmpty(label.text);
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return IsSingleLine(label) ? 18 : 36;
}
public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
{
EditorGUI.BeginProperty(position, label, prop);
if (_min == null)
{
prop.Next(true);
_min = prop.Copy();
prop.Next(true);
_max = prop.Copy();
}
if (IsSingleLine(label))
{
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
}
else
{
EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
var indent = (EditorGUI.indentLevel + 1) * 15f;
position = new Rect(position.x + indent, position.y + 18, position.width - indent, 16);
}
var min = _min.floatValue;
var max = _max.floatValue;
if (Draw(position, ref min, ref max))
{
_min.floatValue = min;
_max.floatValue = max;
}
EditorGUI.EndProperty();
}
public static bool Draw(Rect position, ref float minValue, ref float maxValue)
{
var indentLevel = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
EditorGUI.BeginChangeCheck();
var rect = new Rect(position.x, position.y, k_NumWidth, position.height);
minValue = Mathf.Clamp(EditorGUI.FloatField(rect, minValue), 0, maxValue);
rect.x += rect.width + k_Space;
rect.width = position.width - k_NumWidth * 2 - k_Space * 2;
EditorGUI.MinMaxSlider(rect, ref minValue, ref maxValue, 0, 1);
rect.x += rect.width + k_Space;
rect.width = k_NumWidth;
maxValue = Mathf.Clamp(EditorGUI.FloatField(rect, maxValue), minValue, 1);
EditorGUI.indentLevel = indentLevel;
return EditorGUI.EndChangeCheck();
}
public static bool DrawLayout(GUIContent label, ref float minValue, ref float maxValue)
{
Rect position;
if (IsSingleLine(label))
{
position = EditorGUILayout.GetControlRect(true, 18f);
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
}
else
{
position = EditorGUILayout.GetControlRect(true, 36f);
EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
var indent = (EditorGUI.indentLevel + 1) * 15f;
position = new Rect(position.x + indent, position.y + 18, position.width - indent, 16);
}
return Draw(position, ref minValue, ref maxValue);
}
}
#endif
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dacf9fb8cdb9a4a62a74b629d84cabd3
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
{
@@ -64,13 +69,64 @@ namespace Coffee.UIEffectInternal
#if UNITY_EDITOR
public static T[] GetAllComponentsInPrefabStage<T>() where T : Component
{
if (!PrefabStageUtility.GetCurrentPrefabStage()) return Array.Empty<T>();
var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
if (!prefabStage) return Array.Empty<T>();
if (prefabStage == null) return Array.Empty<T>();
return prefabStage.prefabContentsRoot.GetComponentsInChildren<T>(true);
}
public static bool isBatchOrBuilding => Application.isBatchMode || BuildPipeline.isBuildingPlayer;
#endif
[Conditional("UNITY_EDITOR")]
public static void QueuePlayerLoopUpdate()
{
#if UNITY_EDITOR
if (!EditorApplication.isPlaying)
{
EditorApplication.QueuePlayerLoopUpdate();
}
#endif
}
}
#if !UNITY_2021_2_OR_NEWER
[AttributeUsage(AttributeTargets.Class)]
[Conditional("UNITY_EDITOR")]
internal class IconAttribute : Attribute
{
private readonly string _path;
public IconAttribute(string path)
{
_path = path;
}
#if UNITY_EDITOR
private static Action<Object, Texture2D> s_SetIconForObject = typeof(EditorGUIUtility)
.GetMethod("SetIconForObject", BindingFlags.Static | BindingFlags.NonPublic)
.CreateDelegate(typeof(Action<Object, Texture2D>), null) as Action<Object, Texture2D>;
[InitializeOnLoadMethod]
private static void InitializeOnLoadMethod()
{
if (Misc.isBatchOrBuilding) return;
var types = TypeCache.GetTypesWithAttribute<IconAttribute>();
var scripts = MonoImporter.GetAllRuntimeMonoScripts();
foreach (var type in types)
{
var script = scripts.FirstOrDefault(x => x.GetClass() == type);
if (!script) continue;
var path = type.GetCustomAttribute<IconAttribute>()?._path;
var icon = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
if (!icon) continue;
s_SetIconForObject(script, icon);
}
}
#endif
}
#endif
}
@@ -6,15 +6,58 @@ namespace Coffee.UIEffectInternal
/// <summary>
/// Object pool.
/// </summary>
internal class ObjectPool<T>
internal class InternalObjectPool<T> where T : class
{
#if UNITY_2021_1_OR_NEWER
private readonly Predicate<T> _onValid; // Delegate for checking if instances are valid
private readonly UnityEngine.Pool.ObjectPool<T> _pool;
public InternalObjectPool(Func<T> onCreate, Predicate<T> onValid, Action<T> onReturn)
{
_pool = new UnityEngine.Pool.ObjectPool<T>(onCreate, null, onReturn);
_onValid = onValid;
}
/// <summary>
/// Rent an instance from the pool.
/// When you no longer need it, return it with <see cref="Return" />.
/// </summary>
public T Rent()
{
while (0 < _pool.CountInactive)
{
var instance = _pool.Get();
if (_onValid(instance))
{
return instance;
}
}
// If there are no instances in the pool, create a new one.
Logging.Log(this, $"A new instance is created (pooled: {_pool.CountInactive}, created: {_pool.CountAll}).");
return _pool.Get();
}
/// <summary>
/// Return an instance to the pool and assign null.
/// Be sure to return the instance obtained with <see cref="Rent" /> with this method.
/// </summary>
public void Return(ref T instance)
{
if (instance == null) return; // Ignore if already pooled or null.
_pool.Release(instance);
Logging.Log(this, $"An instance is released (pooled: {_pool.CountInactive}, created: {_pool.CountAll}).");
instance = default; // Set the reference to null.
}
#else
private readonly Func<T> _onCreate; // Delegate for creating instances
private readonly Action<T> _onReturn; // Delegate for returning instances to the pool
private readonly Predicate<T> _onValid; // Delegate for checking if instances are valid
private readonly Stack<T> _pool = new Stack<T>(32); // Object pool
private int _count; // Total count of created instances
public ObjectPool(Func<T> onCreate, Predicate<T> onValid, Action<T> onReturn)
public InternalObjectPool(Func<T> onCreate, Predicate<T> onValid, Action<T> onReturn)
{
_onCreate = onCreate;
_onValid = onValid;
@@ -54,15 +97,40 @@ namespace Coffee.UIEffectInternal
Logging.Log(this, $"An instance is released (pooled: {_pool.Count}, created: {_count}).");
instance = default; // Set the reference to null.
}
#endif
}
/// <summary>
/// Object pool for <see cref="List{T}" />.
/// </summary>
internal static class ListPool<T>
internal static class InternalListPool<T>
{
private static readonly ObjectPool<List<T>> s_ListPool =
new ObjectPool<List<T>>(() => new List<T>(), _ => true, x => x.Clear());
#if UNITY_2021_1_OR_NEWER
/// <summary>
/// Rent an instance from the pool.
/// When you no longer need it, return it with <see cref="Return" />.
/// </summary>
public static List<T> Rent()
{
return UnityEngine.Pool.ListPool<T>.Get();
}
/// <summary>
/// Return an instance to the pool and assign null.
/// Be sure to return the instance obtained with <see cref="Rent" /> with this method.
/// </summary>
public static void Return(ref List<T> toRelease)
{
if (toRelease != null)
{
UnityEngine.Pool.ListPool<T>.Release(toRelease);
}
toRelease = null;
}
#else
private static readonly InternalObjectPool<List<T>> s_ListPool =
new InternalObjectPool<List<T>>(() => new List<T>(), _ => true, x => x.Clear());
/// <summary>
/// Rent an instance from the pool.
@@ -81,5 +149,6 @@ namespace Coffee.UIEffectInternal
{
s_ListPool.Return(ref toRelease);
}
#endif
}
}
@@ -0,0 +1,58 @@
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;
public readonly float max;
public readonly float power;
public PowerRangeAttribute(float min, float max, float power)
{
this.min = min;
this.max = max;
this.power = power;
}
}
#if UNITY_EDITOR
[CustomPropertyDrawer(typeof(PowerRangeAttribute))]
internal sealed class RangeDrawer : PropertyDrawer
{
public override void OnGUI(Rect r, SerializedProperty property, GUIContent label)
{
var labelWidth = EditorGUIUtility.labelWidth;
var attr = (PowerRangeAttribute)attribute;
label = EditorGUI.BeginProperty(r, label, property);
EditorGUI.BeginChangeCheck();
var rSlider = new Rect(r.x + labelWidth + 1, r.y, r.width - labelWidth - 57, r.height);
var powValue = Mathf.Log(property.floatValue, attr.power);
var powMin = Mathf.Log(attr.min, attr.power);
var powMax = Mathf.Log(attr.max, attr.power);
powValue = GUI.HorizontalSlider(rSlider, powValue, powMin, powMax);
if (EditorGUI.EndChangeCheck())
{
property.floatValue = Mathf.Clamp(Mathf.Pow(attr.power, powValue), attr.min, attr.max);
}
EditorGUI.BeginChangeCheck();
EditorGUIUtility.labelWidth = r.width - 53;
var newValue = EditorGUI.FloatField(r, label, property.floatValue);
if (EditorGUI.EndChangeCheck())
{
property.floatValue = Mathf.Clamp(newValue, attr.min, attr.max);
}
EditorGUI.EndProperty();
EditorGUIUtility.labelWidth = labelWidth;
}
}
#endif
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1c353a915a3dd4175bed99560cfc1aad
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -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:
@@ -0,0 +1,468 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;
#if UNITY_EDITOR
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEditorInternal;
using PackageInfo = UnityEditor.PackageManager.PackageInfo;
using Object = UnityEngine.Object;
#endif
namespace Coffee.UIEffectInternal
{
[Serializable]
public class ShaderVariantRegistry
{
[Serializable]
internal class StringPair : IEquatable<StringPair>
{
public string key;
public string value;
public bool Equals(StringPair other)
{
if (other == null) return false;
if (ReferenceEquals(this, other)) return true;
return key == other.key && value == other.value;
}
public override bool Equals(object obj)
{
return obj is StringPair other && Equals(other);
}
public override int GetHashCode()
{
unchecked
{
return ((key != null ? key.GetHashCode() : 0) * 397) ^ (value != null ? value.GetHashCode() : 0);
}
}
}
private Dictionary<int, string> _cachedOptionalShaders = new Dictionary<int, string>();
[SerializeField]
private List<StringPair> m_OptionalShaders = new List<StringPair>();
[SerializeField]
internal ShaderVariantCollection m_Asset;
#if UNITY_EDITOR
[SerializeField]
private bool m_ErrorOnUnregisteredVariant = false;
[SerializeField]
private List<StringPair> m_UnregisteredVariants = new List<StringPair>();
#endif
public ShaderVariantCollection shaderVariantCollection => m_Asset;
public Func<string, bool> onShaderRequested;
public Shader FindOptionalShader(Shader shader,
string requiredName,
string format,
string defaultOptionalShaderName)
{
if (!shader) return null;
// Already cached.
var id = shader.GetInstanceID();
if (_cachedOptionalShaders.TryGetValue(id, out var optionalShaderName))
{
return Shader.Find(optionalShaderName);
}
// The shader has required name.
var shaderName = shader.name;
if (shaderName.Contains(requiredName))
{
_cachedOptionalShaders[id] = shaderName;
return shader;
}
// Find optional shader.
Shader optionalShader;
foreach (var pair in m_OptionalShaders)
{
if (pair.key != shaderName) continue;
optionalShader = Shader.Find(pair.value);
if (optionalShader)
{
_cachedOptionalShaders[id] = pair.value;
return optionalShader;
}
}
// Find optional shader by format.
optionalShaderName = string.Format(format, shaderName);
optionalShader = Shader.Find(optionalShaderName);
if (optionalShader)
{
_cachedOptionalShaders[id] = optionalShaderName;
return optionalShader;
}
#if UNITY_EDITOR
if (onShaderRequested?.Invoke(optionalShaderName) ?? false)
{
return Shader.Find(defaultOptionalShaderName);
}
#endif
// Find default optional shader.
_cachedOptionalShaders[id] = defaultOptionalShaderName;
return Shader.Find(defaultOptionalShaderName);
}
#if UNITY_EDITOR
private readonly HashSet<StringPair> _logVariants = new HashSet<StringPair>();
public void ClearCache()
{
_cachedOptionalShaders.Clear();
}
/// <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)
{
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)
{
RegisterOptionalShaders(owner, path);
}
}
/// <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)
{
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.
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)
{
// Find shader.
var shader = AssetDatabase.LoadAssetAtPath<Shader>(path);
if (!shader) return;
var shaderName = shader.name;
foreach (var key in keys)
{
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))
{
// Find ShaderVariantCollection in owner.
var path = AssetDatabase.GetAssetPath(owner);
var collection = AssetDatabase.LoadAssetAtPath<ShaderVariantCollection>(path);
if (collection)
{
m_Asset = collection;
}
// Create new ShaderVariantCollection.
else
{
m_Asset = new ShaderVariantCollection() { name = "ShaderVariants" };
AssetDatabase.AddObjectToAsset(m_Asset, owner);
}
EditorUtility.SetDirty(owner);
AssetDatabase.SaveAssets();
}
ClearCache();
Profiler.EndSample();
}
internal void RegisterVariant(Material material, string path)
{
if (!material || !material.shader || !m_Asset) return;
Profiler.BeginSample("(EDITOR/COF)[ShaderVariantRegistry] RegisterVariant");
var shaderName = material.shader.name;
var validKeywords = material.shaderKeywords
.Where(x => !Regex.IsMatch(x, "(_EDITOR|EDITOR_)"))
.ToArray();
var keywords = string.Join(" ", validKeywords);
var variant = new ShaderVariantCollection.ShaderVariant
{
shader = material.shader,
keywords = validKeywords
};
// Already registered.
var pair = new StringPair() { key = shaderName, value = keywords };
if (m_Asset.Contains(variant))
{
m_UnregisteredVariants.Remove(pair);
Profiler.EndSample();
return;
}
// Error when unregistered variant.
if (m_ErrorOnUnregisteredVariant)
{
if (!m_UnregisteredVariants.Contains(pair))
{
m_UnregisteredVariants.Add(pair);
}
if (_logVariants.Add(pair))
{
keywords = string.IsNullOrEmpty(keywords) ? "no keywords" : keywords;
Debug.LogError($"Shader variant '{shaderName} <{keywords}>' is not registered.\n" +
$"Register it in 'ProjectSettings > {path}' to use it in player.", m_Asset);
}
Profiler.EndSample();
return;
}
m_Asset.Add(variant);
m_UnregisteredVariants.Remove(pair);
Profiler.EndSample();
}
#endif
}
#if UNITY_EDITOR
internal class ShaderVariantRegistryEditor
{
private static readonly MethodInfo s_MiDrawShaderEntry =
Type.GetType("UnityEditor.ShaderVariantCollectionInspector, UnityEditor")
?.GetMethod("DrawShaderEntry", BindingFlags.NonPublic | BindingFlags.Instance);
private readonly SerializedProperty _errorOnUnregisteredVariant;
private readonly SerializedProperty _asset;
private readonly ReorderableList _rlOptionalShaders;
private readonly ReorderableList _rlUnregisteredVariants;
private Editor _editor;
private bool _expand;
public ShaderVariantRegistryEditor(SerializedProperty property, string optionName, Action onFindOptions)
{
var so = property.serializedObject;
var optionalShaders = property.FindPropertyRelative("m_OptionalShaders");
var unregisteredVariants = property.FindPropertyRelative("m_UnregisteredVariants");
_errorOnUnregisteredVariant = property.FindPropertyRelative("m_ErrorOnUnregisteredVariant");
_asset = property.FindPropertyRelative("m_Asset");
_rlOptionalShaders = new ReorderableList(so, optionalShaders, false, true, true, true);
_rlOptionalShaders.drawHeaderCallback = rect =>
{
var rLabel = new Rect(rect.x, rect.y, rect.width - 80, rect.height);
EditorGUI.LabelField(rLabel,
EditorGUIUtility.TrTextContent($"Optional Shaders {optionName}",
"Specify optional shaders explicitly."));
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();
}
};
_rlOptionalShaders.elementHeight = EditorGUIUtility.singleLineHeight * 2 + 4;
_rlOptionalShaders.drawElementCallback = (r, index, isActive, isFocused) =>
{
if (optionalShaders.arraySize <= index) return;
var element = optionalShaders.GetArrayElementAtIndex(index);
if (element == null) return;
var key = element.FindPropertyRelative("key");
var value = element.FindPropertyRelative("value");
var h = EditorGUIUtility.singleLineHeight;
var rKey = new Rect(r.x, r.y + 2, r.width, h);
if (GUI.Button(rKey, key.stringValue, EditorStyles.popup))
{
ShowShaderDropdown(key, optionName, false);
}
var rArrow = new Rect(r.x, r.y + h + 4, 20, h);
EditorGUI.LabelField(rArrow, "->");
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);
}
};
_rlUnregisteredVariants = new ReorderableList(so, unregisteredVariants, false, true, false, true);
_rlUnregisteredVariants.drawHeaderCallback = rect =>
{
var rWarning = new Rect(rect.x, rect.y, 20, rect.height);
var icon = EditorGUIUtility.TrIconContent("warning",
"These variants are not registered.\nRegister them to use in player.");
EditorGUI.LabelField(rWarning, icon);
var rLabel = new Rect(rect.x + 20, rect.y, 200, rect.height);
EditorGUI.LabelField(rLabel, "Unregistered Shader Variants");
var rButton = new Rect(rect.x + rect.width - 60, rect.y, 60, rect.height - 4);
if (GUI.Button(rButton, "Clear All", EditorStyles.miniButton))
{
unregisteredVariants.ClearArray();
}
};
_rlUnregisteredVariants.elementHeight = EditorGUIUtility.singleLineHeight * 2 + 4;
_rlUnregisteredVariants.drawElementCallback = (r, index, isActive, isFocused) =>
{
if (unregisteredVariants.arraySize <= index) return;
var element = unregisteredVariants.GetArrayElementAtIndex(index);
if (element == null) return;
var key = element.FindPropertyRelative("key");
var value = element.FindPropertyRelative("value");
var h = EditorGUIUtility.singleLineHeight;
var rKey = new Rect(r.x, r.y + 2, r.width, h);
EditorGUI.LabelField(rKey, key.stringValue, EditorStyles.popup);
var rValue = new Rect(r.x + 20, r.y + h + 5, r.width - 40, 14);
var keywords = string.IsNullOrEmpty(value.stringValue) ? "<no keywords>" : value.stringValue;
EditorGUI.TextField(rValue, GUIContent.none, keywords, "LODRenderersText");
var rButton = new Rect(r.x + r.width - 20, r.y + h + 4, 20, h);
if (GUI.Button(rButton, EditorGUIUtility.IconContent("icons/toolbar plus.png"), "iconbutton"))
{
var collection = _asset.objectReferenceValue as ShaderVariantCollection;
AddVariant(collection, key.stringValue, value.stringValue);
unregisteredVariants.DeleteArrayElementAtIndex(index);
}
};
}
public void Draw()
{
_rlOptionalShaders.DoLayoutList();
_expand = DrawRegisteredShaderVariants(_expand, _asset, ref _editor);
if (0 < _rlUnregisteredVariants.serializedProperty.arraySize)
{
EditorGUILayout.Space(4);
_rlUnregisteredVariants.DoLayoutList();
EditorGUILayout.Space(-20);
}
var labelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 180;
EditorGUILayout.PropertyField(_errorOnUnregisteredVariant);
EditorGUIUtility.labelWidth = labelWidth;
}
private static void AddVariant(ShaderVariantCollection collection, string shaderName, string keywords)
{
if (collection == null) return;
var shader = Shader.Find(shaderName);
if (!shader) return;
collection.Add(new ShaderVariantCollection.ShaderVariant
{
shader = shader,
keywords = keywords.Split(' ')
});
EditorUtility.SetDirty(collection);
}
private static bool DrawRegisteredShaderVariants(bool expand, SerializedProperty property, ref Editor editor)
{
var collection = property.objectReferenceValue as ShaderVariantCollection;
if (collection == null) return expand;
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);
expand = EditorGUI.Foldout(rLabel, expand, "Registered Shader Variants");
var rButton = new Rect(r.x + r.width - 82, r.y + 1, 80, r.height - 4);
if (GUI.Button(rButton, "Clear All", EditorStyles.miniButton))
{
collection.Clear();
}
if (expand)
{
EditorGUILayout.BeginVertical("RL Background");
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++)
{
drawShaderEntry?.Invoke(i);
}
EditorGUILayout.EndVertical();
editor.serializedObject.ApplyModifiedProperties();
}
return expand;
}
private static void ShowShaderDropdown(SerializedProperty property, string option, bool required)
{
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)
{
menu.AddItem(new GUIContent(shaderName), shaderName == current, () =>
{
property.stringValue = shaderName;
property.serializedObject.ApplyModifiedProperties();
});
}
menu.ShowAsContext();
}
}
#endif
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f5bfa8bba9d0847069c9091cfa8dfb84
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,82 @@
using UnityEngine;
namespace Coffee.UIEffectInternal
{
public enum TransformSensitivity
{
Low,
Medium,
High
}
/// <summary>
/// Extension methods for Transform class.
/// </summary>
internal static class TransformExtensionsForTransformSensitivity
{
private const float k_DefaultEpsilon = 1f / (2 ^ 8);
/// <summary>
/// Check if a transform has changed.
/// </summary>
public static bool HasChanged(this Transform self, ref Matrix4x4 prev, TransformSensitivity sensitivity)
{
return self.HasChanged_Internal(null, ref prev, Convert(sensitivity));
}
/// <summary>
/// Check if a transform has changed.
/// </summary>
public static bool HasChanged(this Transform self, Transform baseTransform, ref Matrix4x4 prev,
TransformSensitivity sensitivity)
{
return self.HasChanged_Internal(baseTransform, ref prev, Convert(sensitivity));
}
private static float Convert(TransformSensitivity self)
{
switch (self)
{
case TransformSensitivity.Low: return 1f / (1 << 4);
case TransformSensitivity.Medium: return 1f / (1 << 8);
case TransformSensitivity.High: return 1f / (1 << 12);
default: return 1f / (1 << (int)self);
}
}
private static bool HasChanged_Internal(this Transform self, Transform baseTransform, ref Matrix4x4 prev,
float epsilon)
{
if (!self) return false;
var hash = baseTransform ? baseTransform.GetHashCode() : 0;
if (FrameCache.TryGet(self, nameof(HasChanged), hash, out bool result)) return result;
var matrix = baseTransform
? baseTransform.worldToLocalMatrix * self.localToWorldMatrix
: self.localToWorldMatrix;
var current = matrix * Matrix4x4.Scale(Vector3.one * 10000);
result = !Approximately(current, prev, epsilon);
FrameCache.Set(self, nameof(HasChanged), hash, result);
if (result)
{
prev = current;
}
return result;
}
private static bool Approximately(Matrix4x4 self, Matrix4x4 other, float epsilon = k_DefaultEpsilon)
{
for (var i = 0; i < 16; i++)
{
if (epsilon < Mathf.Abs(self[i] - other[i]))
{
return false;
}
}
return true;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9fd2b201d1fc94556b5bc7617788cd0c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -53,7 +53,7 @@ namespace Coffee.UIEffectInternal
/// <summary>
/// Event that occurs when the screen size changes.
/// </summary>
public static event Action onScreenSizeChangedAction
public static event Action onScreenSizeChanged
{
add => s_OnScreenSizeChangedAction.Add(value);
remove => s_OnScreenSizeChangedAction.Remove(value);
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:
+91 -209
View File
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using System;
using System.Runtime.CompilerServices;
using Coffee.UIEffectInternal;
using UnityEngine;
@@ -7,9 +6,6 @@ using UnityEngine.EventSystems;
using UnityEngine.Profiling;
using UnityEngine.UI;
using UnityEditor;
#if TMP_ENABLE
using TMPro;
#endif
[assembly: InternalsVisibleTo("UIEffect")]
[assembly: InternalsVisibleTo("Coffee.UIEffect.Editor")]
@@ -20,19 +16,21 @@ namespace Coffee.UIEffects
[DisallowMultipleComponent]
public abstract class UIEffectBase : UIBehaviour, IMeshModifier, IMaterialModifier, ICanvasRaycastFilter
{
private static readonly VertexHelper s_VertexHelper = new VertexHelper();
private static Mesh s_Mesh;
private static readonly Dictionary<int, string> s_ShaderNameCache = new Dictionary<int, string>();
private static readonly ObjectPool<UIEffectContext> s_ContextPool =
new ObjectPool<UIEffectContext>(() => new UIEffectContext(), x => true, x => x.Reset());
private static readonly InternalObjectPool<UIEffectContext> s_ContextPool =
new InternalObjectPool<UIEffectContext>(() => new UIEffectContext(), x => true, x => x.Reset());
private Graphic _graphic;
private Material _material;
private UIEffectContext _context;
private Action _onBeforeCanvasRebuild;
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;
public virtual bool canModifyShape => true;
public virtual UIEffectContext context
{
@@ -50,9 +48,16 @@ namespace Coffee.UIEffects
public virtual RectTransform transitionRoot => transform as RectTransform;
public virtual Flip flip
{
get => 0;
set { }
}
protected override void OnEnable()
{
UIExtraCallbacks.onScreenSizeChangedAction += SetVerticesDirtyIfTextMeshPro;
_onBeforeCanvasRebuild ??= OnBeforeCanvasRebuild;
UIExtraCallbacks.onBeforeCanvasRebuild += _onBeforeCanvasRebuild;
UpdateContext(context);
SetMaterialDirty();
SetVerticesDirty();
@@ -60,7 +65,11 @@ namespace Coffee.UIEffects
protected override void OnDisable()
{
UIExtraCallbacks.onScreenSizeChangedAction -= SetVerticesDirtyIfTextMeshPro;
if (_onBeforeCanvasRebuild != null)
{
UIExtraCallbacks.onBeforeCanvasRebuild -= _onBeforeCanvasRebuild;
}
MaterialRepository.Release(ref _material);
SetMaterialDirty();
SetVerticesDirty();
@@ -68,9 +77,19 @@ namespace Coffee.UIEffects
protected override void OnDestroy()
{
_onBeforeCanvasRebuild = null;
_graphic = null;
s_ContextPool.Return(ref _context);
}
protected virtual void OnBeforeCanvasRebuild()
{
if (!_canModifyMesh && CanModifyMesh())
{
SetVerticesDirty();
}
}
public void ModifyMesh(Mesh mesh)
{
}
@@ -79,7 +98,23 @@ namespace Coffee.UIEffects
{
if (!isActiveAndEnabled || context == null) return;
context.ModifyMesh(graphic, transitionRoot, vh);
_canModifyMesh = CanModifyMesh();
if (_canModifyMesh)
{
context.ModifyMesh(graphic, transitionRoot, vh, canModifyShape, flip);
}
}
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)
@@ -91,68 +126,44 @@ namespace Coffee.UIEffects
}
Profiler.BeginSample("(UIE)[UIEffect] GetModifiedMaterial");
var hash = new Hash128((uint)baseMaterial.GetInstanceID(), effectId, 0, 0);
var samplingScaleId = (uint)(Mathf.InverseLerp(0.01f, 100, actualSamplingScale) * uint.MaxValue);
var hash = new Hash128((uint)baseMaterial.GetInstanceID(), effectId, samplingScaleId, 0);
if (!MaterialRepository.Valid(hash, _material))
{
Profiler.BeginSample("(UIE)[UIEffect] GetModifiedMaterial > Get or create material");
MaterialRepository.Get(hash, ref _material, x => new Material(x)
{
shader = FindShader(x),
shader = UIEffectProjectSettings.shaderRegistry.FindOptionalShader(x.shader,
"(UIEffect)",
"Hidden/{0} (UIEffect)",
"Hidden/UI/Default (UIEffect)"),
hideFlags = HideFlags.HideAndDontSave
}, baseMaterial);
Profiler.EndSample();
}
ApplyContextToMaterial();
_material.CopyPropertiesFromMaterial(baseMaterial);
ApplyContextToMaterial(_material);
Profiler.EndSample();
return _material;
}
private static Shader FindShader(Material material)
{
var shader = material.shader;
var hash = shader.GetInstanceID();
if (!s_ShaderNameCache.TryGetValue(hash, out var shaderName))
{
shaderName = shader.name;
if (!shaderName.Contains("(UIEffect)"))
{
shaderName = $"Hidden/{shaderName} (UIEffect)";
}
var uiEffectShader = Shader.Find(shaderName);
if (!uiEffectShader)
{
shaderName = "Hidden/UI/Default (UIEffect)";
uiEffectShader = Shader.Find(shaderName);
}
s_ShaderNameCache[hash] = shaderName;
return uiEffectShader;
}
return Shader.Find(shaderName);
}
#if UNITY_EDITOR
protected override void OnValidate()
{
UpdateContext(context);
ApplyContextToMaterial();
SetVerticesDirty();
SetMaterialDirty();
if (!EditorApplication.isPlaying)
{
EditorApplication.QueuePlayerLoopUpdate();
}
}
protected override void Reset()
{
OnValidate();
}
internal virtual void SetEnablePreviewIfSelected(GameObject[] selection)
{
}
#endif
protected override void OnRectTransformDimensionsChange()
@@ -164,192 +175,63 @@ namespace Coffee.UIEffects
protected override void OnDidApplyAnimationProperties()
{
UpdateContext(context);
ApplyContextToMaterial();
SetVerticesDirty();
SetMaterialDirty();
}
public virtual void SetVerticesDirty()
{
#if TMP_ENABLE
if (graphic is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
{
if (isActiveAndEnabled)
{
OnTMPChanged(textMeshProUGUI);
var canvas = graphic.canvas;
if (canvas && graphic.isActiveAndEnabled)
{
canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord2;
}
}
else if (0 < textMeshProUGUI.textInfo?.meshInfo?.Length
&& 0 < textMeshProUGUI.textInfo.meshInfo[0].vertexCount)
{
textMeshProUGUI.UpdateVertexData();
}
}
else
#endif
if (graphic)
{
graphic.SetVerticesDirty();
var canvas = graphic.canvas;
if (canvas && graphic.isActiveAndEnabled)
{
canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord1;
}
GraphicProxy.Find(graphic).SetVerticesDirty(graphic, enabled);
Misc.QueuePlayerLoopUpdate();
}
}
private void SetVerticesDirtyIfTextMeshPro()
{
#if TMP_ENABLE
if (graphic && graphic.isActiveAndEnabled
&& (graphic is TextMeshProUGUI || graphic is TMP_SubMeshUI))
{
graphic.SetVerticesDirty();
}
#endif
}
public virtual void SetMaterialDirty()
{
if (graphic)
{
graphic.SetMaterialDirty();
Misc.QueuePlayerLoopUpdate();
}
}
protected abstract void UpdateContext(UIEffectContext c);
public virtual void ApplyContextToMaterial()
protected bool CheckTransformChangedWith(Transform root)
{
if (!isActiveAndEnabled || context == null) return;
var sensitivity = UIEffectProjectSettings.transformSensitivity;
return root
&& root != transform
&& transform.HasChanged(root, ref _prevTransformHash, sensitivity);
}
context.ApplyToMaterial(_material);
internal void ReleaseMaterial()
{
MaterialRepository.Release(ref _material);
}
internal abstract void UpdateContext(UIEffectContext c);
public virtual void ApplyContextToMaterial(Material material)
{
if (!isActiveAndEnabled || context == null || !material) return;
context.ApplyToMaterial(material, actualSamplingScale);
#if UNITY_EDITOR
UIEffectProjectSettings.RegisterVariant(_material);
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
}
#if TMP_ENABLE
#if UNITY_EDITOR
private class MyAllPostprocessor : AssetPostprocessor
{
private static void OnPostprocessAllAssets(string[] _, string[] __, string[] ___, string[] ____)
{
if (Application.isBatchMode || BuildPipeline.isBuildingPlayer) return;
s_ShaderNameCache.Clear();
foreach (var effect in Misc.FindObjectsOfType<UIEffectBase>()
.Concat(Misc.GetAllComponentsInPrefabStage<UIEffectBase>()))
{
if (!effect.isActiveAndEnabled) continue;
if (!(effect.graphic is TextMeshProUGUI tmp) || !tmp.isActiveAndEnabled) continue;
effect.SetMaterialDirty();
}
EditorApplication.QueuePlayerLoopUpdate();
}
}
#endif
#if UNITY_EDITOR
[InitializeOnLoadMethod]
#else
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
#endif
private static void InitializeOnLoad()
{
TMPro_EventManager.TEXT_CHANGED_EVENT.Add(obj =>
{
if (obj is TextMeshProUGUI textMeshProUGUI)
{
OnTMPChanged(textMeshProUGUI);
}
});
}
private static void OnTMPChanged(TextMeshProUGUI textMeshProUGUI)
{
if (!textMeshProUGUI.TryGetComponent<UIEffectBase>(out var effect)) return;
if (!effect || !effect.isActiveAndEnabled) return;
if (!s_Mesh)
{
s_Mesh = new Mesh();
s_Mesh.MarkDynamic();
}
var target = effect is UIEffect uiEffect
? uiEffect
: effect is UIEffectReplica parentReplica
? parentReplica.target
: null;
var subMeshes = ListPool<TMP_SubMeshUI>.Rent();
var modifiers = ListPool<IMeshModifier>.Rent();
textMeshProUGUI.GetComponentsInChildren(subMeshes, 1);
for (var i = 0; i < textMeshProUGUI.textInfo.meshInfo.Length; i++)
{
var meshInfo = textMeshProUGUI.textInfo.meshInfo[i];
s_VertexHelper.Clear();
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);
}
s_VertexHelper.FillMesh(s_Mesh);
textMeshProUGUI.canvasRenderer.SetMesh(s_Mesh);
}
else if (i - 1 < subMeshes.Count)
{
var subMeshUI = GetSubMeshUI(subMeshes, meshInfo.material);
if (!target || !subMeshUI) break;
var replica = subMeshUI.GetOrAddComponent<UIEffectReplica>();
replica.target = target;
subMeshUI.GetComponents(modifiers);
foreach (var modifier in modifiers)
{
modifier.ModifyMesh(s_VertexHelper);
}
s_VertexHelper.FillMesh(s_Mesh);
replica.ApplyContextToMaterial();
subMeshUI.canvasRenderer.SetMesh(s_Mesh);
}
else
{
break;
}
}
ListPool<IMeshModifier>.Return(ref modifiers);
ListPool<TMP_SubMeshUI>.Return(ref subMeshes);
s_Mesh.Clear(false);
}
private static TMP_SubMeshUI GetSubMeshUI(List<TMP_SubMeshUI> subMeshes, Material material)
{
for (var j = 0; j < subMeshes.Count; j++)
{
if (subMeshes[j].sharedMaterial == material) return subMeshes[j];
}
return null;
}
#endif
public abstract void SetRate(float rate, UIEffectTweener.CullingMask cullingMask);
public abstract bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera);
}
File diff suppressed because it is too large Load Diff
+149 -86
View File
@@ -3,7 +3,6 @@ using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Coffee.UIEffectInternal;
using Coffee.UIEffects;
using UnityEditor;
using UnityEngine;
@@ -11,19 +10,6 @@ namespace Coffee.UIEffects
{
public class UIEffectProjectSettings : PreloadedProjectSettings<UIEffectProjectSettings>
{
public enum FallbackVariantBehaviour
{
RegisterShaderVariant,
LogError
}
public enum TransformSensitivity
{
Low,
Medium,
High
}
[Tooltip(
"The sensitivity of the transformation when `Use Target Transform` is enabled in the `UIEffectReplica` component.")]
[Header("Setting")]
@@ -33,37 +19,32 @@ namespace Coffee.UIEffects
[SerializeField]
internal List<UIEffect> m_RuntimePresets = new List<UIEffect>();
[SerializeField]
[Header("Editor")]
internal FallbackVariantBehaviour m_FallbackVariantBehaviour = FallbackVariantBehaviour.RegisterShaderVariant;
[Tooltip("Use HDR color pickers on color fields.")]
[SerializeField] private bool m_UseHDRColorPicker = true;
[HideInInspector]
[SerializeField]
internal List<string> m_UnregisteredShaderVariants = new List<string>();
[SerializeField]
[Header("Shader")]
internal ShaderVariantCollection m_ShaderVariantCollection;
[HideInInspector]
[SerializeField]
private ShaderVariantRegistry m_ShaderVariantRegistry = new ShaderVariantRegistry();
public static ShaderVariantRegistry shaderRegistry => instance.m_ShaderVariantRegistry;
public static ShaderVariantCollection shaderVariantCollection => shaderRegistry.shaderVariantCollection;
public static TransformSensitivity transformSensitivity
{
get => instance.m_TransformSensitivity;
set => instance.m_TransformSensitivity = value;
}
public static ShaderVariantCollection shaderVariantCollection => instance.m_ShaderVariantCollection;
public static float sensitivity
public static bool useHdrColorPicker
{
get
{
switch (instance.m_TransformSensitivity)
{
case TransformSensitivity.Low: return 1f / (1 << 2);
case TransformSensitivity.Medium: return 1f / (1 << 5);
case TransformSensitivity.High: return 1f / (1 << 12);
default: return 1f / (1 << (int)instance.m_TransformSensitivity);
}
}
get => instance.m_UseHDRColorPicker;
set => instance.m_UseHDRColorPicker = value;
}
public static void RegisterRuntimePreset(UIEffect effect)
@@ -96,15 +77,112 @@ 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.6.0 (Unity 6)";
#else
const string tmpSupport = "TextMeshPro Support";
const string version = "v5.6.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)
});
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);
}
};
}
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_ShaderVariantCollection = new ShaderVariantCollection()
{
name = "UIEffectShaderVariants"
};
AssetDatabase.AddObjectToAsset(m_ShaderVariantCollection, this);
EditorUtility.SetDirty(this);
AssetDatabase.SaveAssets();
m_ShaderVariantRegistry.InitializeIfNeeded(this);
m_ShaderVariantRegistry.RegisterOptionalShaders(this);
}
protected override void OnInitialize()
{
m_ShaderVariantRegistry.InitializeIfNeeded(this);
}
private void Reset()
{
m_ShaderVariantRegistry.InitializeIfNeeded(this);
m_ShaderVariantRegistry.RegisterOptionalShaders(this);
}
internal static UIEffect[] LoadEditorPresets()
@@ -112,6 +190,7 @@ 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)
@@ -147,64 +226,48 @@ namespace Coffee.UIEffects
return new PreloadedProjectSettingsProvider("Project/UI/UI Effect");
}
internal static string GetPresetPath(UIEffect preset)
internal static (string path, bool builtin) GetPresetPath(UIEffect 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);
}
internal static void ClearUnregisteredShaderVariants()
private class Postprocessor : AssetPostprocessor
{
instance.m_UnregisteredShaderVariants.Clear();
}
internal static void RegisterVariant(string variant)
{
var values = variant.Split(';');
instance.m_ShaderVariantCollection.Add(new ShaderVariantCollection.ShaderVariant()
private static void OnPostprocessAllAssets(string[] imported, string[] deleted, string[] ___, string[] ____)
{
shader = Shader.Find(values[0]),
keywords = values[1].Split('|')
});
instance.m_UnregisteredShaderVariants.Remove(variant);
}
if (Misc.isBatchOrBuilding) return;
internal static void RegisterVariant(ShaderVariantCollection.ShaderVariant variant)
{
instance.m_ShaderVariantCollection.Add(variant);
}
// Register optional shaders when shaders are imported.
if (imported.Concat(deleted).Any(path => path.EndsWith(".shader")))
{
MaterialRepository.Clear();
internal static void RegisterVariant(Material material)
{
if (!material || !material.shader || !instance.m_ShaderVariantCollection) return;
var variant = new ShaderVariantCollection.ShaderVariant
{
shader = material.shader,
keywords = material.shaderKeywords
};
// Already registered.
if (instance.m_ShaderVariantCollection.Contains(variant)) return;
switch (instance.m_FallbackVariantBehaviour)
{
case FallbackVariantBehaviour.RegisterShaderVariant:
RegisterVariant(variant);
break;
case FallbackVariantBehaviour.LogError:
var shaderName = variant.shader.name;
var keywords = string.Join("|", variant.keywords);
var v = $"{shaderName};{keywords}";
if (!instance.m_UnregisteredShaderVariants.Contains(v))
// Refresh
if (hasInstance)
{
instance.m_UnregisteredShaderVariants.Add(v);
shaderRegistry.ClearCache();
shaderRegistry.RegisterOptionalShaders(instance);
}
Debug.LogError($"{shaderName} with keywords <{keywords}> is not registered.\n" +
"Please register it in 'Project Settings > UI > UIEffect > Shader'.");
return;
// 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
+124 -31
View File
@@ -3,13 +3,26 @@ using UnityEngine;
namespace Coffee.UIEffects
{
[Icon("Packages/com.coffee.ui-effect/Editor/UIEffectIconIcon.png")]
public class UIEffectReplica : UIEffectBase
{
[SerializeField] private UIEffect m_Target;
[SerializeField] private bool m_UseTargetTransform = true;
[PowerRange(0.01f, 100, 10f)]
[SerializeField]
protected float m_SamplingScale = 1f;
[SerializeField]
protected bool m_AllowToModifyMeshShape = true;
[SerializeField]
protected RectTransform m_CustomRoot = null;
[SerializeField]
protected Flip m_Flip = 0;
private UIEffect _currentTarget;
private Matrix4x4 _prevTransformHash;
public UIEffect target
{
@@ -35,34 +48,106 @@ namespace Coffee.UIEffects
}
}
public override uint effectId => target ? target.effectId : 0;
public override UIEffectContext context => target && target.isActiveAndEnabled ? target.context : null;
public RectTransform customRoot
{
get => m_CustomRoot;
set
{
if (m_CustomRoot == value) return;
m_CustomRoot = value;
SetVerticesDirty();
}
}
public override RectTransform transitionRoot => useTargetTransform && target
public float samplingScale
{
get => m_SamplingScale;
set
{
value = Mathf.Clamp(value, 0.01f, 100);
if (Mathf.Approximately(m_SamplingScale, value)) return;
m_SamplingScale = value;
SetMaterialDirty();
}
}
public bool allowToModifyMeshShape
{
get => m_AllowToModifyMeshShape;
set
{
if (m_AllowToModifyMeshShape == value) return;
m_AllowToModifyMeshShape = value;
SetVerticesDirty();
}
}
public override Flip flip
{
get => m_Flip;
set
{
if (m_Flip == value) return;
m_Flip = 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
{
get
{
if (!target) return null;
if (!isTargetInScene) return base.context;
return target.isActiveAndEnabled ? 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();
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)
{
if (!isTargetInScene) return;
target.SetEnablePreviewIfSelected(selection);
}
#endif
private void RefreshTarget(UIEffect newTarget)
@@ -73,22 +158,44 @@ 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)
protected override void OnBeforeCanvasRebuild()
{
base.OnBeforeCanvasRebuild();
if (useTargetTransform && isTargetInScene && CheckTransformChangedWith(target.transform))
{
SetVerticesDirty();
}
}
public override void ApplyContextToMaterial()
internal override void UpdateContext(UIEffectContext c)
{
if (!isActiveAndEnabled || !target || !target.isActiveAndEnabled) return;
if (target && !isTargetInScene)
{
target.UpdateContext(c);
}
}
base.ApplyContextToMaterial();
public override void ApplyContextToMaterial(Material material)
{
if (!isActiveAndEnabled || !target) return;
if (isTargetInScene && !target.isActiveAndEnabled) return;
base.ApplyContextToMaterial(material);
}
public override void SetRate(float rate, UIEffectTweener.CullingMask mask)
@@ -97,23 +204,9 @@ namespace Coffee.UIEffects
public override bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera)
{
return !target || target.IsRaycastLocationValid(sp, eventCamera);
}
if (!isActiveAndEnabled || !isTargetInScene) return true;
private bool CheckTransform()
{
return useTargetTransform
&& target
&& transform.HasChanged(target.transform, ref _prevTransformHash,
UIEffectProjectSettings.sensitivity);
}
private void SetVerticesDirtyIfTransformChanged()
{
if (CheckTransform())
{
SetVerticesDirty();
}
return target.IsRaycastLocationValid(sp, eventCamera);
}
}
}
+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:
+345 -42
View File
@@ -1,18 +1,32 @@
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
{
Tone = 1 << 0,
Color = 1 << 1,
Sampling = 1 << 2,
Transition = 1 << 3
Transition = 1 << 3,
GradiationOffset = 1 << 5,
GradiationRotation = 1 << 6,
EdgeShiny = 1 << 8,
Event = 1 << 31
}
public enum UpdateMode
@@ -36,10 +50,19 @@ namespace Coffee.UIEffects
Reverse
}
public enum PlayOnEnable
{
None,
Forward,
Reverse,
KeepDirection
}
[Tooltip("The culling mask of the tween.")]
[SerializeField]
private CullingMask m_CullingMask =
CullingMask.Tone | CullingMask.Color | CullingMask.Sampling | CullingMask.Transition;
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]
@@ -49,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)]
@@ -64,12 +94,17 @@ namespace Coffee.UIEffects
[Range(0f, 10)]
private float m_Interval;
[Tooltip("Whether to restart the tween when enabled.")]
[FormerlySerializedAs("m_ResetTimeOnEnable")]
[Tooltip("Play the tween when the component is enabled.")]
[SerializeField]
private bool m_RestartOnEnable = true;
private PlayOnEnable m_PlayOnEnable = PlayOnEnable.Forward;
[Tooltip("Reset the tweening time when the component is enabled.")]
[SerializeField]
private bool m_ResetTimeOnEnable = true;
[Tooltip("The wrap mode of the tween.\n" +
" Clamp: Clamp the tween value (not loop).\n" +
" Once: Clamp the tween value (not loop).\n" +
" Loop: Loop the tween value.\n" +
" PingPongOnce: PingPong the tween value (not loop).\n" +
" PingPong: PingPong the tween value.")]
@@ -83,7 +118,16 @@ namespace Coffee.UIEffects
[SerializeField]
private UpdateMode m_UpdateMode = UpdateMode.Normal;
private float _rate;
[Tooltip("Event to invoke when the tween has completed.")]
[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;
private UIEffectBase _target;
@@ -92,12 +136,18 @@ namespace Coffee.UIEffects
/// </summary>
private UIEffectBase target => _target ? _target : _target = GetComponent<UIEffectBase>();
/// <summary>
/// The culling mask of the tween.
/// </summary>
public CullingMask cullingMask
{
get => m_CullingMask;
set => m_CullingMask = value;
}
/// <summary>
/// The direction of the tween.
/// </summary>
public Direction direction
{
get => m_Direction;
@@ -110,7 +160,7 @@ namespace Coffee.UIEffects
public float rate
{
get => _rate;
set
private set
{
value = Mathf.Clamp01(value);
if (Mathf.Approximately(_rate, value)) return;
@@ -118,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);
}
}
}
@@ -158,22 +238,19 @@ namespace Coffee.UIEffects
{
get
{
if (_time < delay) return _time;
var t = _time - delay;
switch (wrapMode)
if (wrapMode == WrapMode.Once || wrapMode == WrapMode.PingPongOnce)
{
case WrapMode.Once:
case WrapMode.PingPongOnce:
return Mathf.Clamp(t, 0, totalTime - delay) + delay;
case WrapMode.Loop:
case WrapMode.PingPongLoop:
return Mathf.Repeat(t, totalTime - delay) + delay;
default:
throw new ArgumentOutOfRangeException();
return Mathf.Clamp(_time, 0, totalTime);
}
return Mathf.Repeat(_time, totalTime);
}
}
/// <summary>
/// The total time of the tween. (read only)
/// </summary>
/// <exception cref="ArgumentOutOfRangeException"></exception>
public float totalTime
{
get
@@ -190,56 +267,243 @@ namespace Coffee.UIEffects
}
}
public bool restartOnEnable
/// <summary>
/// Play the tween when the component is enabled.
/// </summary>
public PlayOnEnable playOnEnable
{
get => m_RestartOnEnable;
set => m_RestartOnEnable = value;
get => m_PlayOnEnable;
set => m_PlayOnEnable = value;
}
/// <summary>
/// Reset the tweening time when the component is enabled..
/// </summary>
public bool resetTimeOnEnable
{
get => m_ResetTimeOnEnable;
set => m_ResetTimeOnEnable = value;
}
/// <summary>
/// The wrap mode of the tween.
/// <p>Once: Clamp the tween value (not loop).</p>
/// <p>Loop: Loop the tween value.</p>
/// <p>PingPongOnce: PingPong the tween value (not loop).</p>
/// <p>PingPong: PingPong the tween value.</p>
/// </summary>
public WrapMode wrapMode
{
get => m_WrapMode;
set => m_WrapMode = value;
}
/// <summary>
/// Specifies how to get delta time.
/// <p>Normal: Use `Time.deltaTime`.</p>
/// <p>Unscaled: Use `Time.unscaledDeltaTime`.</p>
/// <p>Manual: Not updated automatically and update manually with `UpdateTime` or `SetTime` method.</p>
/// </summary>
public UpdateMode updateMode
{
get => m_UpdateMode;
set => m_UpdateMode = value;
}
/// <summary>
/// The curve to tween the properties.
/// </summary>
public AnimationCurve curve
{
get => m_Curve;
set => m_Curve = value;
}
private void Update()
public bool separateReverseCurve
{
switch (m_UpdateMode)
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>
public bool isTweening
{
get
{
case UpdateMode.Normal:
UpdateTime(Time.deltaTime);
break;
case UpdateMode.Unscaled:
UpdateTime(Time.unscaledDeltaTime);
break;
if (_isPaused) return false;
if (wrapMode == WrapMode.Loop || wrapMode == WrapMode.PingPongLoop) return true;
return direction == Direction.Forward
? _time < totalTime
: 0 < _time;
}
}
/// <summary>
/// Is the tween paused?
/// </summary>
public bool isPaused => _isPaused;
/// <summary>
/// Is the tween delaying?
/// </summary>
public bool isDelaying => _time < delay;
private void OnEnable()
{
if (m_RestartOnEnable)
_isPaused = true;
#if UNITY_EDITOR
if (!Application.isPlaying) return;
#endif
switch (playOnEnable)
{
Restart();
case PlayOnEnable.KeepDirection:
Play(resetTimeOnEnable);
break;
case PlayOnEnable.Forward:
PlayForward(resetTimeOnEnable);
break;
case PlayOnEnable.Reverse:
PlayReverse(resetTimeOnEnable);
break;
}
}
public void Restart()
private void OnDisable()
{
_isPaused = true;
}
private void Update()
{
#if UNITY_EDITOR
if (!Application.isPlaying) return;
#endif
if (!isTweening) return;
var deltaTime = m_UpdateMode == UpdateMode.Unscaled
? Time.unscaledDeltaTime
: Time.deltaTime;
UpdateTime(direction == Direction.Forward ? deltaTime : -deltaTime);
}
public void Play(bool resetTime)
{
if (resetTime)
{
ResetTime(direction);
}
Play();
}
public void Play()
{
_isPaused = false;
if (!isTweening)
{
m_OnComplete.Invoke();
}
}
public void PlayForward(bool resetTime)
{
if (resetTime)
{
ResetTime(Direction.Forward);
}
PlayForward();
}
public void PlayForward()
{
direction = Direction.Forward;
_isPaused = false;
if (!isTweening)
{
m_OnComplete.Invoke();
}
}
public void PlayReverse(bool resetTime)
{
if (resetTime)
{
ResetTime(Direction.Reverse);
}
PlayReverse();
}
public void PlayReverse()
{
direction = Direction.Reverse;
_isPaused = false;
if (!isTweening)
{
m_OnComplete.Invoke();
}
}
public void Stop()
{
_isPaused = true;
ResetTime();
}
public void SetPause(bool pause)
{
_isPaused = pause;
}
public void ResetTime()
{
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()
{
ResetTime();
}
public void SetTime(float sec)
{
_time = 0;
@@ -248,33 +512,72 @@ namespace Coffee.UIEffects
public void UpdateTime(float deltaSec)
{
rate = UpdateTime_Internal(Mathf.Max(0, deltaSec)) / duration;
}
private float UpdateTime_Internal(float delta)
{
_time += direction == Direction.Forward ? delta : -delta;
if (_time < delay) return 0;
var prevTweening = isTweening;
var isLoop = wrapMode == WrapMode.Loop || wrapMode == WrapMode.PingPongLoop;
_time += deltaSec;
if (isLoop)
{
if (_time < 0)
{
_time = Mathf.Repeat(_time, totalTime);
}
else if (delay < _time)
{
_time = Mathf.Repeat(_time - delay, totalTime - delay) + delay;
}
else if (deltaSec < 0 && delay <= _time - deltaSec)
{
_time = Mathf.Repeat(_time - delay, totalTime - delay) + delay;
}
}
else
{
_time = Mathf.Clamp(_time, 0, totalTime);
}
var t = _time - delay;
if (t <= 0 && 0 <= _time)
{
rate = 0;
if (prevTweening && !isTweening)
{
m_OnComplete.Invoke();
}
return;
}
switch (wrapMode)
{
case WrapMode.Once:
t = Mathf.Clamp(t, 0, duration);
_time = t + delay;
break;
case WrapMode.Loop:
t = Mathf.Repeat(t, duration + interval);
_time = t + delay;
break;
case WrapMode.PingPongOnce:
t = Mathf.Clamp(t, 0, duration * 2 + interval);
_time = t + delay;
t = Mathf.PingPong(t, duration + interval * 0.5f);
break;
case WrapMode.PingPongLoop:
t = Mathf.Repeat(t, (duration + interval) * 2);
_time = t + delay;
t = t < duration * 2 + interval
? Mathf.PingPong(t, duration + interval * 0.5f)
: 0;
break;
}
return Mathf.Clamp(t, 0, duration);
rate = Mathf.Clamp(t, 0, duration) / duration;
if (prevTweening && !isTweening)
{
m_OnComplete.Invoke();
}
}
}
}
+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:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5fe15d023b85046ceb6202a0d5a9d16f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,394 @@
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);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 23cc1f211cd264050a641c01c4a6d77a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIEffects
{
public class GraphicProxy
{
private static readonly List<GraphicProxy> s_Proxies = new List<GraphicProxy>()
{
new GraphicProxy()
};
public static void Register(GraphicProxy proxy)
{
// Register only once.
foreach (var p in s_Proxies)
{
if (p.GetType() == proxy.GetType()) return;
}
s_Proxies.Add(proxy);
}
public static GraphicProxy Find(Graphic graphic)
{
if (!graphic) return null;
for (var i = s_Proxies.Count - 1; i >= 0; i--)
{
var p = s_Proxies[i];
if (p.IsValid(graphic)) return p;
}
return null;
}
/// <summary>
/// Check if the graphic is valid for this proxy.
/// </summary>
protected virtual bool IsValid(Graphic graphic)
{
return graphic;
}
/// <summary>
/// Check if the graphic is a text.
/// </summary>
public virtual bool IsText(Graphic graphic)
{
return graphic is Text;
}
/// <summary>
/// Called before modifying the mesh.
/// </summary>
public virtual void OnPreModifyMesh(Graphic graphic)
{
UIVertexUtil.onLerpVertex = s_OnLerpVertex;
ShadowUtil.onMarkAsShadow = s_OnMarkAsShadow;
UIEffectContext.onModifyVertex = s_OnModifyVertex;
var canvas = graphic.canvas;
if (canvas)
{
canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord1;
}
}
public virtual void SetVerticesDirty(Graphic graphic, bool enabled)
{
}
public virtual Vector4 ModifyExpandSize(Graphic graphic, Vector2 expandSize)
{
return new Vector4(expandSize.x, expandSize.y, expandSize.x, expandSize.y);
}
private static readonly Func<UIVertex, UIVertex, UIVertex, float, UIVertex> s_OnLerpVertex =
null;
private static readonly Func<UIVertex, UIVertex> s_OnMarkAsShadow =
vt =>
{
vt.uv0.z -= 8;
vt.uv0.w -= 8;
return vt;
};
private static readonly Func<UIVertex, Rect, float, float, UIVertex> s_OnModifyVertex =
(vt, uvMask, normalizedX, normalizedY) =>
{
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,11 @@
fileFormatVersion: 2
guid: c6f31259f929a47bf9cbd8f1b921327e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,57 @@
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, Vector2 expandSize)
{
var image = graphic as Image;
var ret = new Vector4(expandSize.x, expandSize.y, expandSize.x, expandSize.y);
if (image
&& image.type == Image.Type.Filled
&& image.fillMethod == Image.FillMethod.Radial360
&& image.fillAmount <= 0.5f)
{
ret[(image.fillOrigin + (image.fillClockwise ? 2 : 0)) % 4] = 0;
if (image.fillAmount <= 0.25f)
{
ret[(image.fillOrigin + 3) % 4] = 0;
}
}
return ret;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cddfadaf298c14befb49972983c16f2d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Coffee.UIEffects
{
public static class ShadowUtil
{
public static Func<UIVertex, UIVertex> onMarkAsShadow;
public static void DoShadow(List<UIVertex> verts, Vector2[] vectors, Vector2 distance, int iteration,
float fade)
{
UIVertexUtil.ExpandCapacity(verts, 1 + vectors.Length);
distance = new Vector2(Mathf.Clamp(distance.x, -600, 600), Mathf.Clamp(distance.y, -600, 600));
var count = verts.Count;
var start = 0;
var end = count;
var d = Vector2.zero;
var a = fade;
for (var i = 0; i < iteration; i++)
{
d += distance / (i + 1);
ApplyShadow(verts, vectors, ref start, ref end, d, a);
a *= 0.75f;
}
// Mark as shadow vertices.
for (var i = 0; i < verts.Count - count; i++)
{
if (onMarkAsShadow != null)
{
verts[i] = onMarkAsShadow(verts[i]);
}
else
{
var vt = verts[i];
vt.uv0.z -= 8;
vt.uv0.w -= 8;
verts[i] = vt;
}
}
}
public static void DoMirror(List<UIVertex> verts, Vector2 distance, float scale, float fade, RectTransform root)
{
UIVertexUtil.ExpandCapacity(verts, 2);
distance = new Vector2(Mathf.Clamp(distance.x, -600, 600), Mathf.Clamp(distance.y, -600, 600));
var count = verts.Count;
var rect2 = root.rect;
var pivot = root.pivot.y;
var height = rect2.height;
var rate = distance.x;
var offset = distance.y - (scale + 1) * pivot * height;
var range = new Vector2(rect2.yMin, rect2.yMax);
ApplyMirror(verts, count, rate, range, scale, offset, fade);
}
private static void ApplyMirror(List<UIVertex> verts, int count, float rate, Vector2 range, float scale,
float offset, float alpha)
{
rate = Mathf.Clamp01(rate);
var start = 0;
var end = count;
ApplyShadowZeroAlloc(verts, ref start, ref end, 0, 0, alpha);
for (var i = 0; i < count; i += 6)
{
var lb = verts[i];
var lbRate = Mathf.InverseLerp(range.x, range.y, lb.position.y);
var lt = verts[i + 1];
var ltRate = Mathf.InverseLerp(range.x, range.y, lt.position.y);
var rt = verts[i + 2];
var rtRate = Mathf.InverseLerp(range.x, range.y, rt.position.y);
var rb = verts[i + 4];
var rbRate = Mathf.InverseLerp(range.x, range.y, rb.position.y);
lb.color.a = (byte)(Mathf.InverseLerp(rate, 0, lbRate) * lb.color.a);
lt.color.a = (byte)(Mathf.InverseLerp(rate, 0, ltRate) * lt.color.a);
rt.color.a = (byte)(Mathf.InverseLerp(rate, 0, rtRate) * rt.color.a);
rb.color.a = (byte)(Mathf.InverseLerp(rate, 0, rbRate) * rb.color.a);
if (lbRate < rate && rate < ltRate)
{
var t = (rate - lbRate) / (ltRate - lbRate);
lt = UIVertexUtil.VertexLerp(lb, lt, t);
}
if (rbRate < rate && rate < rtRate)
{
var t = (rate - rbRate) / (rtRate - rbRate);
rt = UIVertexUtil.VertexLerp(rb, rt, t);
}
lb.position.y = -lb.position.y * scale + offset;
lt.position.y = -lt.position.y * scale + offset;
rt.position.y = -rt.position.y * scale + offset;
rb.position.y = -rb.position.y * scale + offset;
verts[i] = verts[i + 5] = lb;
verts[i + 1] = lt;
verts[i + 2] = verts[i + 3] = rt;
verts[i + 4] = rb;
}
}
/// <summary>
/// Append shadow vertices.
/// * It is similar to Shadow component implementation.
/// </summary>
private static void ApplyShadow(List<UIVertex> verts, Vector2[] vectors, ref int start, ref int end,
Vector2 distance, float alpha)
{
var x = distance.x;
var y = distance.y;
for (var i = 0; i < vectors.Length; i++)
{
var dx = x * vectors[i].x;
var dy = y * vectors[i].y;
ApplyShadowZeroAlloc(verts, ref start, ref end, dx, dy, alpha);
}
}
/// <summary>
/// Append shadow vertices.
/// * It is similar to Shadow component implementation.
/// </summary>
private static void ApplyShadowZeroAlloc(List<UIVertex> verts, ref int start, ref int end, float x, float y,
float alpha)
{
var count = end - start;
for (var i = 0; i < count; i++)
{
// The original vertices is pushed backward.
verts.Add(verts[end - count + i]);
// Set shadow vertex.
var vt = verts[start + i];
vt.position.x += x;
vt.position.y += y;
vt.color.a = (byte)(alpha * vt.color.a);
verts[start + i] = vt;
}
// Update next shadow offset.
start = end;
end = verts.Count;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 65df2c9dff42a4ddb8bada9fb153b562
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+309
View File
@@ -0,0 +1,309 @@
#if TMP_ENABLE
using System;
using System.Collections.Generic;
using Coffee.UIEffectInternal;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using Object = UnityEngine.Object;
namespace Coffee.UIEffects
{
internal class TmpProxy : GraphicProxy
{
/// <summary>
/// Check if the graphic is valid for this proxy.
/// </summary>
protected override bool IsValid(Graphic graphic)
{
if (!graphic) return false;
if (graphic is TextMeshProUGUI) return true;
if (graphic is TMP_SubMeshUI sub)
{
// If TMP_SubMeshUI is used for text
return !sub.spriteAsset
|| sub.sharedMaterial != sub.spriteAsset.material;
}
return false;
}
/// <summary>
/// Check if the graphic is a text.
/// </summary>
public override bool IsText(Graphic graphic)
{
return true;
}
/// <summary>
/// Called before modifying the mesh.
/// </summary>
public override void OnPreModifyMesh(Graphic graphic)
{
UIVertexUtil.onLerpVertex = s_OnLerpVertex;
ShadowUtil.onMarkAsShadow = s_OnMarkAsShadow;
UIEffectContext.onModifyVertex = s_OnModifyVertex;
var canvas = graphic.canvas;
if (canvas)
{
canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord2;
}
}
public override void SetVerticesDirty(Graphic graphic, bool enabled)
{
if (graphic is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
{
if (enabled)
{
OnChangeText(textMeshProUGUI);
}
else if (0 < textMeshProUGUI.textInfo?.meshInfo?.Length
&& 0 < textMeshProUGUI.textInfo.meshInfo[0].vertexCount)
{
textMeshProUGUI.UpdateVertexData();
}
}
}
private static readonly Func<UIVertex, UIVertex, UIVertex, float, UIVertex> s_OnLerpVertex =
#if UNITY_2023_2_OR_NEWER
null;
#else
(vt, a, b, t) =>
{
// TMP 3.x uses packed UV
vt.uv1.x = PackUV(Vector2.Lerp(UnpackUV(a.uv1.x), UnpackUV(b.uv1.x), t));
return vt;
static float PackUV(Vector2 input)
{
return (int)(input.x * 511) * 4096 + (int)(input.y * 511);
}
static Vector2 UnpackUV(float input)
{
return new Vector2(input / 4096 / 511, input % 4096 / 511);
}
};
#endif
private static readonly Func<UIVertex, UIVertex> s_OnMarkAsShadow =
vt =>
{
vt.uv1.z -= 8;
vt.uv1.w -= 8;
return vt;
};
private static readonly Func<UIVertex, Rect, float, float, UIVertex> s_OnModifyVertex =
(vt, uvMask, normalizedX, normalizedY) =>
{
vt.uv1.z = normalizedX;
vt.uv1.w = normalizedY;
vt.uv2 = new Vector4(uvMask.xMin, uvMask.yMin, uvMask.xMax, uvMask.yMax);
return vt;
};
private static Mesh s_Mesh;
private static readonly VertexHelper s_VertexHelper = new VertexHelper();
private static readonly HashSet<TextMeshProUGUI> s_ChangedInstances = new HashSet<TextMeshProUGUI>();
private static readonly HashSet<TextMeshProUGUI> s_RegisteredInstances = new HashSet<TextMeshProUGUI>();
private static readonly Dictionary<int, float> s_SdfScaleCache = new Dictionary<int, float>();
#if UNITY_EDITOR
[InitializeOnLoadMethod]
#endif
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void InitializeOnLoad()
{
s_ChangedInstances.Clear();
s_RegisteredInstances.Clear();
s_SdfScaleCache.Clear();
Register(new TmpProxy());
// When the text is changed, add it to the changed list
TMPro_EventManager.TEXT_CHANGED_EVENT.Add(obj =>
{
if (obj is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
{
s_ChangedInstances.Add(textMeshProUGUI);
}
});
UIExtraCallbacks.onBeforeCanvasRebuild += () =>
{
// Check SDF scale (lossyScale.y) change
var toRemove = InternalListPool<TextMeshProUGUI>.Rent();
foreach (var textMeshProUGUI in s_RegisteredInstances)
{
if (textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
{
var id = textMeshProUGUI.GetHashCode();
var lossyScaleY = textMeshProUGUI.transform.lossyScale.y;
// If the scale has changed, add to the changed list
if (s_SdfScaleCache.TryGetValue(id, out var prev) && !Mathf.Approximately(prev, lossyScaleY))
{
OnChangeText(textMeshProUGUI);
}
// Update the scale cache
s_SdfScaleCache[id] = textMeshProUGUI.transform.lossyScale.y;
}
// Remove destroyed objects later
else if (!ReferenceEquals(textMeshProUGUI, null))
{
toRemove.Add(textMeshProUGUI);
}
}
// Remove destroyed objects
foreach (var textMeshProUGUI in toRemove)
{
s_SdfScaleCache.Remove(textMeshProUGUI.GetHashCode());
s_RegisteredInstances.Remove(textMeshProUGUI);
}
InternalListPool<TextMeshProUGUI>.Return(ref toRemove);
};
// Modify the changed TMP mesh
UIExtraCallbacks.onAfterCanvasRebuild += () =>
{
foreach (var textMeshProUGUI in s_ChangedInstances)
{
if (!textMeshProUGUI || !textMeshProUGUI.isActiveAndEnabled) continue;
ModifyMesh(textMeshProUGUI);
}
s_ChangedInstances.Clear();
};
#if UNITY_EDITOR
UnityEditor.SceneManagement.EditorSceneManager.sceneSaved += _ =>
{
foreach (var textMeshProUGUI in s_RegisteredInstances)
{
if (!textMeshProUGUI || !textMeshProUGUI.isActiveAndEnabled) continue;
if (textMeshProUGUI.TryGetComponent<UIEffectBase>(out var effect) && effect.isActiveAndEnabled)
{
effect.ReleaseMaterial();
effect.SetMaterialDirty();
}
}
Misc.QueuePlayerLoopUpdate();
};
#endif
}
private static void OnChangeText(Object obj)
{
if (obj is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
{
s_ChangedInstances.Add(textMeshProUGUI);
}
}
private static void ModifyMesh(TextMeshProUGUI textMeshProUGUI)
{
if (!s_Mesh)
{
s_Mesh = new Mesh();
s_Mesh.MarkDynamic();
}
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];
s_VertexHelper.Clear();
meshInfo.mesh.CopyTo(s_VertexHelper, meshInfo.vertexCount, meshInfo.vertexCount * 6 / 4);
if (i == 0)
{
foreach (var modifier in modifiers)
{
modifier.ModifyMesh(s_VertexHelper);
}
s_VertexHelper.FillMesh(s_Mesh);
textMeshProUGUI.canvasRenderer.SetMesh(s_Mesh);
}
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 (!subMeshUI) break;
var replica = subMeshUI.GetOrAddComponent<UIEffectReplica>();
if (effect is UIEffect pEffect && pEffect.isActiveAndEnabled)
{
replica.target = pEffect;
replica.useTargetTransform = true;
replica.customRoot = null;
replica.flip = pEffect.flip;
}
else if (effect is UIEffectReplica pReplica && pReplica.isActiveAndEnabled)
{
replica.target = pReplica.target;
replica.useTargetTransform = pReplica.useTargetTransform;
replica.customRoot = pReplica.customRoot;
replica.flip = pReplica.flip;
}
else
{
replica.target = null;
replica.customRoot = null;
}
subMeshUI.GetComponents(subModifiers);
foreach (var modifier in subModifiers)
{
modifier.ModifyMesh(s_VertexHelper);
}
s_VertexHelper.FillMesh(s_Mesh);
subMeshUI.canvasRenderer.SetMesh(s_Mesh);
}
else
{
break;
}
}
InternalListPool<TMP_SubMeshUI>.Return(ref subMeshes);
InternalListPool<IMeshModifier>.Return(ref modifiers);
InternalListPool<IMeshModifier>.Return(ref subModifiers);
s_Mesh.Clear(false);
}
private static TMP_SubMeshUI GetSubMeshUI(List<TMP_SubMeshUI> subMeshes, Material material, int start)
{
var count = subMeshes.Count;
for (var j = 0; j < count; j++)
{
var s = subMeshes[(j + start + count) % count];
if (s.sharedMaterial == material) return s;
}
return null;
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b2ffc93dc93f34027ad9bfdbfd61caae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,334 @@
using System;
using System.Collections.Generic;
using Coffee.UIEffectInternal;
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIEffects
{
internal static class UIVertexUtil
{
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);
if (verts.Capacity < capacity)
{
verts.Capacity = capacity;
}
}
public static void Expand(List<UIVertex> verts, int start, int bundleSize, Vector4 expandSize, Rect bounds)
{
if (expandSize == Vector4.zero) return;
for (var j = 0; j < bundleSize; j += 3)
{
if (bounds.Contains(verts[start + j + 0].position)
&& bounds.Contains(verts[start + j + 1].position)
&& bounds.Contains(verts[start + j + 2].position))
{
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 < 3; k++)
{
var vt = verts[start + j + k];
var pos = vt.position;
var uv0 = vt.uv0;
// Expand edge vertex
if (pos.x < bounds.xMin)
{
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)
{
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;
vt.uv0.x = uv0.x;
vt.uv0.y = uv0.y;
verts[start + j + k] = vt;
}
}
}
public static UIVertex VertexLerp(UIVertex a, UIVertex b, float t)
{
var vt = new UIVertex
{
position = Vector3.Lerp(a.position, b.position, t),
normal = Vector3.Lerp(a.normal, b.normal, t),
tangent = Vector4.Lerp(a.tangent, b.tangent, t),
color = Color.Lerp(a.color, b.color, t),
uv0 = Vector4.Lerp(a.uv0, b.uv0, t),
uv1 = Vector4.Lerp(a.uv1, b.uv1, t),
uv2 = Vector4.Lerp(a.uv2, b.uv2, t)
};
if (onLerpVertex != null)
{
vt = onLerpVertex(vt, a, b, t);
}
return vt;
}
public static void GetBounds(List<UIVertex> verts, int start, int bundleSize, out Rect posBounds,
out Rect uvBounds)
{
var minPos = new Vector2(float.MaxValue, float.MaxValue);
var maxPos = new Vector2(float.MinValue, float.MinValue);
var minUV = new Vector2(float.MaxValue, float.MaxValue);
var maxUV = new Vector2(float.MinValue, float.MinValue);
for (var i = start; i < start + bundleSize; i++)
{
var vt = verts[i];
UpdateMinMax(ref minPos, ref maxPos, vt.position);
UpdateMinMax(ref minUV, ref maxUV, vt.uv0);
}
// Shrink coordinate to avoid uv edge
posBounds = new Rect(minPos.x + 0.001f, minPos.y + 0.001f,
maxPos.x - minPos.x - 0.002f, maxPos.y - minPos.y - 0.002f);
uvBounds = new Rect(minUV.x, minUV.y, maxUV.x - minUV.x, maxUV.y - minUV.y);
return;
static void UpdateMinMax(ref Vector2 min, ref Vector2 max, Vector2 value)
{
if (value.x < min.x) min.x = value.x; // Left
if (max.x < value.x) max.x = value.x; // Right
if (value.y < min.y) min.y = value.y; // Bottom
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;
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9c1b302b92b3d4460b4e61e5b0135668
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

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