Merge upstream changes from 5.2

--HG--
branch : develop_5.3
pull/413/head
Simon (darkside) Jackson 2015-12-02 17:14:12 +00:00
commit 21b25437a8
33 changed files with 1265 additions and 612 deletions

147
README.md
View File

@ -3,9 +3,8 @@
This is an extension project for the new Unity UI system which can be found at: This is an extension project for the new Unity UI system which can be found at:
[Unity UI Source](https://bitbucket.org/Unity-Technologies/ui) [Unity UI Source](https://bitbucket.org/Unity-Technologies/ui)
#Updated for 5.2.1P+/5.3 - new asset package#
#For Unity 5.2.2+ - Use the new 5.3 package!# #For Unity 5.2.2+ - Use the new 5.3 package!#
#Issue with 5.3 package in 5.2.3 resolved, update asset from site#
##Intro## ##Intro##
For more info, here's a little introduction video for the project: For more info, here's a little introduction video for the project:
@ -19,7 +18,6 @@ In this repository is a collection of extension scripts to enhance your Unity UI
You can either download / fork the project to access the scripts, or you can download this precompiled Unity Asset, chock full of goodness You can either download / fork the project to access the scripts, or you can download this precompiled Unity Asset, chock full of goodness
### [Unity UI Extensions Unity 4.x Asset](https://bitbucket.org/ddreaper/unity-ui-extensions/downloads/UnityUIExtensions-4.x.unitypackage)### ### [Unity UI Extensions Unity 4.x Asset](https://bitbucket.org/ddreaper/unity-ui-extensions/downloads/UnityUIExtensions-4.x.unitypackage)###
### [Unity UI Extensions Unity 5.1 Asset](https://bitbucket.org/ddreaper/unity-ui-extensions/downloads/UnityUIExtensions-5.1.unitypackage)### ### [Unity UI Extensions Unity 5.1 Asset](https://bitbucket.org/ddreaper/unity-ui-extensions/downloads/UnityUIExtensions-5.1.unitypackage)###
### [Unity UI Extensions Unity 5.2 Asset](https://bitbucket.org/ddreaper/unity-ui-extensions/downloads/UnityUIExtensions-5.2.unitypackage)###
### [Unity UI Extensions Unity 5.3 (5.2.1P+) Asset](https://bitbucket.org/ddreaper/unity-ui-extensions/downloads/UnityUIExtensions-5.3.unitypackage) <- use this for 5.2.1P+ releases### ### [Unity UI Extensions Unity 5.3 (5.2.1P+) Asset](https://bitbucket.org/ddreaper/unity-ui-extensions/downloads/UnityUIExtensions-5.3.unitypackage) <- use this for 5.2.1P+ releases###
@ -29,16 +27,20 @@ To get started with the project, here's a little guide:
[![View Getting Started Video](http://img.youtube.com/vi/sVLeYmsNQAI/0.jpg)](http://www.youtube.com/watch?v=sVLeYmsNQAI "Unity UI getting started video") [![View Getting Started Video](http://img.youtube.com/vi/sVLeYmsNQAI/0.jpg)](http://www.youtube.com/watch?v=sVLeYmsNQAI "Unity UI getting started video")
--- ---
## Updates: ## ## Updates: ##
Update 1.0.4 ###Update 1.0.4###
[![View Getting Started Video](http://img.youtube.com/vi/oF48Qpaq3ls/0.jpg)](http://www.youtube.com/watch?v=oF48Qpaq3ls "Update 1.0.0.4 for the Unity UI Extensions Project") [![View Getting Started Video](http://img.youtube.com/vi/oF48Qpaq3ls/0.jpg)](http://www.youtube.com/watch?v=oF48Qpaq3ls "Update 1.0.0.4 for the Unity UI Extensions Project")
---
Update 1.0.5 ###Update 1.0.5###
Few minor fixes and a couple of additional scripts. Predominatly created the new 5.3 branch to maintain the UI API changes from the 5.2.1 Patch releases. 5.3 package is 100% compatible with 5.2.1 Patch releases. Few minor fixes and a couple of additional scripts. Predominatly created the new 5.3 branch to maintain the UI API changes from the 5.2.1 Patch releases. 5.3 package is 100% compatible with 5.2.1 Patch releases.
Update 1.0.6 ###Update 1.0.6###
Added the awesome ReOrderable List control, plus some other minor bugfixes / changes. * Added the awesome ReOrderable List control, plus some other minor bugfixes / changes.
Added a new version of the Scroll Snap control as an alternative to the fixed versions. * Added a new version of the Scroll Snap control as an alternative to the fixed versions.
* New set of controls including some shader ennhanced solutions
* I've added a donate column to the lists. If you are getting great use out of a control, help out the dev who created it. Optional of course. Will update with links as I get them.
Note to self, record video on this soon!! :S
--- ---
## Controls and extensions listed in this project are: ## ## Controls and extensions listed in this project are: ##
@ -46,114 +48,114 @@ Added a new version of the Scroll Snap control as an alternative to the fixed ve
## Controls ## ## Controls ##
================ ================
Control | Description | Menu Command | Component Command | Notes | Credits Control | Description | Menu Command | Component Command | Notes | Donate | Credits
--------- | -------------- | ---------------------- | ---------------------------- | ------- | ---------- --------- | -------------- | ---------------------- | ---------------------------- | ------- | ----------
**Accordion** | An Acordian style control with animated segments. Sourced from [here]. | N/A | Component / UI / Extensions / AccordionGroup |[demo video](http://forum.unity3d.com/threads/accordion-type-layout.271818/)| ChoMPHi **Accordion** | An Acordian style control with animated segments. Sourced from [here]. | N/A | Component / UI / Extensions / AccordionGroup |[demo video](http://forum.unity3d.com/threads/accordion-type-layout.271818/)|| ChoMPHi
| | | Component / UI / Extensions / AccordionItem |[demo video](http://forum.unity3d.com/threads/accordion-type-layout.271818/)| ChoMPHi | | | Component / UI / Extensions / AccordionItem |[demo video](http://forum.unity3d.com/threads/accordion-type-layout.271818/)|| ChoMPHi
**HSVPicker** | A colour picker UI | N/A | UI / Extensions / HSVPicker | Project folder includes prefab and sample scene | judah4 **HSVPicker** | A colour picker UI | N/A | UI / Extensions / HSVPicker | Project folder includes prefab and sample scene || judah4
**SelectionBox** | An RTS style selection box control | UI / Extensions / Selection Box | UI / Extensions / Selection Box |[tutorial video](https://www.youtube.com/watch?v=UtM3HejKL5s)| Korindian, BenZed **SelectionBox** | An RTS style selection box control | UI / Extensions / Selection Box | UI / Extensions / Selection Box |[tutorial video](https://www.youtube.com/watch?v=UtM3HejKL5s)|| Korindian, BenZed
**UIButton** | Improved Button control with additional events (PointerDown, PointerUp, PointerClick and PointerHeld) | UI / Extensions / UI Button | UI / Extensions / UI Button |Will update video, this has now been updated to a more reusable Selectable extension| AriathTheWise **UIButton** | Improved Button control with additional events (PointerDown, PointerUp, PointerClick and PointerHeld) | UI / Extensions / UI Button | UI / Extensions / UI Button |Will update video, this has now been updated to a more reusable Selectable extension|| AriathTheWise
**UIFlippable** | Improved Image control with image flipping options | UI / Extensions / UI Flippable | UI / Extensions / Flippable |[tutorial video](https://www.youtube.com/watch?v=Htt2RNa2qy0)| ChoMPHi **UIFlippable** | Improved Image control with image flipping options | UI / Extensions / UI Flippable | UI / Extensions / Flippable |[tutorial video](https://www.youtube.com/watch?v=Htt2RNa2qy0)|| ChoMPHi
**UIWindowBase** | A draggable Window implementation | UI / Extensions / UI Window Base | UI / Extensions / UI Window Base |[tutorial video](https://www.youtube.com/watch?v=Htt2RNa2qy0)| GXMark, alexzzzz, CaoMengde777, TroyDavis **UIWindowBase** | A draggable Window implementation | UI / Extensions / UI Window Base | UI / Extensions / UI Window Base |[tutorial video](https://www.youtube.com/watch?v=Htt2RNa2qy0)|| GXMark, alexzzzz, CaoMengde777, TroyDavis
**ComboBox** | A fixed combobox implementation for text | UI / Extensions / ComboBox | UI / Extensions / ComboBox |[tutorial video](https://www.youtube.com/watch?v=JrEfs47FoOE)| Perchik **ComboBox** | A fixed combobox implementation for text | UI / Extensions / ComboBox | UI / Extensions / ComboBox |[tutorial video](https://www.youtube.com/watch?v=JrEfs47FoOE)|| Perchik
**AutoCompleteComboBox** | A text combobox with autocomplete selection | UI / Extensions / AutoComplete ComboBox | UI / Extensions / AutoComplete ComboBox |[tutorial video](https://www.youtube.com/watch?v=JrEfs47FoOE)| Perchik **AutoCompleteComboBox** | A text combobox with autocomplete selection | UI / Extensions / AutoComplete ComboBox | UI / Extensions / AutoComplete ComboBox |[tutorial video](https://www.youtube.com/watch?v=JrEfs47FoOE)|| Perchik
**DropDownList** | A basic drop down list with text and image support | UI / Extensions / Dropdown List | UI / Extensions / Dropdown List |[tutorial video](https://www.youtube.com/watch?v=JrEfs47FoOE)| Perchik **DropDownList** | A basic drop down list with text and image support | UI / Extensions / Dropdown List | UI / Extensions / Dropdown List |[tutorial video](https://www.youtube.com/watch?v=JrEfs47FoOE)|| Perchik
**BoundToolTip** | An alternate Tooltip implementation with central listener | UI / Extensions / Bound Tooltip / Tooltip | UI / Extensions / Bound Tooltip / Tooltip Item | Offset and tooltip placement needs work | Martin Sharkbomb **BoundToolTip** | An alternate Tooltip implementation with central listener | UI / Extensions / Bound Tooltip / Tooltip | UI / Extensions / Bound Tooltip / Tooltip Item | Offset and tooltip placement needs work || Martin Sharkbomb
| | | UI / Extensions / Bound Tooltip / Tooltip Trigger | | Martin Sharkbomb | | | UI / Extensions / Bound Tooltip / Tooltip Trigger ||| Martin Sharkbomb
## Primitives ## ## Primitives ##
================ ================
Control | Description | Menu Command | Component Command | Notes | Credits Control | Description | Menu Command | Component Command | Notes | Donate | Credits
--------- | -------------- | ---------------------- | ---------------------------- | ------- | ---------- --------- | -------------- | ---------------------- | ---------------------------- | ------- | ----------
**LineRenderer** | Graphic control for drawing lines in the UI System | UI / Extensions / Primitives / UI Line Renderer | UI / Extensions / Primitives / UI Line Renderer |[tutorial video](https://www.youtube.com/watch?v=OElcWAZGHi0)| jack.sydorenko **LineRenderer** | Graphic control for drawing lines in the UI System | UI / Extensions / Primitives / UI Line Renderer | UI / Extensions / Primitives / UI Line Renderer |[tutorial video](https://www.youtube.com/watch?v=OElcWAZGHi0)|| jack.sydorenko
**UILineTextureRenderer** | Graphic control for drawing lines in the UI System | UI / Extensions / Primitives / UI Line Texture Renderer | UI / Extensions / Primitives / UI Line Texture Renderer |[tutorial video](https://www.youtube.com/watch?v=OElcWAZGHi0)| jack.sydorenko, jonbro5556 **UILineTextureRenderer** | Graphic control for drawing lines in the UI System | UI / Extensions / Primitives / UI Line Texture Renderer | UI / Extensions / Primitives / UI Line Texture Renderer |[tutorial video](https://www.youtube.com/watch?v=OElcWAZGHi0)|| jack.sydorenko, jonbro5556
**UICircle** | Graphic control for drawing circles in the UI System | UI / Extensions / Primitives / UI Circle | UI / Extensions / Primitives / UI Circle |[tutorial video](https://www.youtube.com/watch?v=2KOnEKAVua0)| zge **UICircle** | Graphic control for drawing circles in the UI System | UI / Extensions / Primitives / UI Circle | UI / Extensions / Primitives / UI Circle |[tutorial video](https://www.youtube.com/watch?v=2KOnEKAVua0)|| zge
**DiamondGraph** | Graphic control for drawing a diamond in the UI System | UI / Extensions / Primitives / DiamondGraph | UI / Extensions / Primitives / DiamondGraph |5.2+ only [tutorial video](https://www.youtube.com/watch?v=2KOnEKAVua0)| koohddang **DiamondGraph** | Graphic control for drawing a diamond in the UI System | UI / Extensions / Primitives / DiamondGraph | UI / Extensions / Primitives / DiamondGraph |5.2+ only [tutorial video](https://www.youtube.com/watch?v=2KOnEKAVua0)|| koohddang
**UICornerCut** | Graphic control for drawing a diamond in the UI System | UI/Extensions/Primitives/Cut Corners | UI/Extensions/Primitives/Cut Corners || Freezy **UICornerCut** | Graphic control for drawing a diamond in the UI System | UI/Extensions/Primitives/Cut Corners | UI/Extensions/Primitives/Cut Corners ||| Freezy
## Layouts ## ## Layouts ##
================ ================
Layout | Description | Menu Command | Component Command | Notes | Credits Layout | Description | Menu Command | Component Command | Notes | Donate | Credits
--------- | -------------- | ---------------------- | ---------------------------- | ------- | ---------- --------- | -------------- | ---------------------- | ---------------------------- | ------- | ----------
**HorizontalScrollSnap** | A pages scroll rect that can work in steps / pages, includes button support | UI / Extensions / Horizontal Scroll Snap | Layout / Extensions / Horizontal Scroll Snap |[tutorial video](https://www.youtube.com/watch?v=KJlIlWHlfMo)| BinaryX **HorizontalScrollSnap** | A pages scroll rect that can work in steps / pages, includes button support | UI / Extensions / Horizontal Scroll Snap | Layout / Extensions / Horizontal Scroll Snap |[tutorial video](https://www.youtube.com/watch?v=KJlIlWHlfMo)|| BinaryX
**VerticalScrollSnap** | A pages scroll rect that can work in steps / pages, includes button support | UI / Extensions / Vertical Scroll Snap | Layout / Extensions / Vertical Scroll Snap |[tutorial video](https://www.youtube.com/watch?v=KJlIlWHlfMo)| BinaryX, Simon Darkside Jackson **VerticalScrollSnap** | A pages scroll rect that can work in steps / pages, includes button support | UI / Extensions / Vertical Scroll Snap | Layout / Extensions / Vertical Scroll Snap |[tutorial video](https://www.youtube.com/watch?v=KJlIlWHlfMo)|| BinaryX, Simon Darkside Jackson
**FlowLayoutGroup** | A more rugged grid style layout group || Layout / Extensions / Flow Layout Group | [Example Video](https://www.youtube.com/watch?v=tMe_3tJTZvc) | Simie **FlowLayoutGroup** | A more rugged grid style layout group || Layout / Extensions / Flow Layout Group | [Example Video](https://www.youtube.com/watch?v=tMe_3tJTZvc) || Simie
**RadialLayout** | A radial layout system || Layout / Extensions / Radial Layout |[tutorial video](https://www.youtube.com/watch?v=iUlk0d2RDMs)| Danny Goodayle **RadialLayout** | A radial layout system || Layout / Extensions / Radial Layout |[tutorial video](https://www.youtube.com/watch?v=iUlk0d2RDMs)|| Danny Goodayle
**TileSizeFitter** | A fitter layout that will shink / expand content by tiles || Layout / Extensions / TileSizeFitter |[tutorial video](https://www.youtube.com/watch?v=AkQNWl8mnxg)| Ges **TileSizeFitter** | A fitter layout that will shink / expand content by tiles || Layout / Extensions / TileSizeFitter |[tutorial video](https://www.youtube.com/watch?v=AkQNWl8mnxg)|| Ges
**ScrollSnap** | An alternate scroll snap control supporting both Horizontal and Vertial layous in one control | UI / Extensions / Fixed Item Scroll / Snap Horizontal Single Item||| xesenix **ScrollSnap** | An alternate scroll snap control supporting both Horizontal and Vertial layous in one control | UI / Extensions / Fixed Item Scroll / Snap Horizontal Single Item|||| xesenix
|| UI / Extensions / Fixed Item Scroll / Snap Horizontal Multiple Item||| xesenix || UI / Extensions / Fixed Item Scroll / Snap Horizontal Multiple Item|||| xesenix
|| UI / Extensions / Fixed Item Scroll / Snap Vertical Single Item||| xesenix || UI / Extensions / Fixed Item Scroll / Snap Vertical Single Item|||| xesenix
|| UI / Extensions / Fixed Item Scroll / Snap Vertical Multiple Item||| xesenix || UI / Extensions / Fixed Item Scroll / Snap Vertical Multiple Item|||| xesenix
**ReorderableList** | A dynamic control allowing drag and drop of child elements with reordering support | UI/Extensions/Re-orderable Lists/Re-orderable Vertical Scroll Rect|UI/Extensions/Re-orderable list|[Example](http://i.giphy.com/3o85xri0ARKKSfDHIQ.gif)| Ziboo **ReorderableList** | A dynamic control allowing drag and drop of child elements with reordering support | UI/Extensions/Re-orderable Lists/Re-orderable Vertical Scroll Rect|UI/Extensions/Re-orderable list|[Example](http://i.giphy.com/3o85xri0ARKKSfDHIQ.gif)|| Ziboo
|| UI/Extensions/Re-orderable Lists/Re-orderable Horizontal Scroll Rect||| Ziboo || UI/Extensions/Re-orderable Lists/Re-orderable Horizontal Scroll Rect|||| Ziboo
|| UI/Extensions/Re-orderable Lists/Re-orderable Grid Scroll Rect||| Ziboo || UI/Extensions/Re-orderable Lists/Re-orderable Grid Scroll Rect|||| Ziboo
|| UI/Extensions/Re-orderable Lists/Re-orderable Vertical List||| Ziboo || UI/Extensions/Re-orderable Lists/Re-orderable Vertical List|||| Ziboo
|| UI/Extensions/Re-orderable Lists/Re-orderable Hirizontal List||| Ziboo || UI/Extensions/Re-orderable Lists/Re-orderable Hirizontal List|||| Ziboo
|| UI/Extensions/Re-orderable Lists/Re-orderable Grid||| Ziboo || UI/Extensions/Re-orderable Lists/Re-orderable Grid|||| Ziboo
## Effect components ## ## Effect components ##
===================== =====================
Effect | Description | Component Command | Notes | Credits Effect | Description | Component Command | Notes | Donate | Credits
--------- | -------------- | ---------------------------- | ------- | ----------- --------- | -------------- | ---------------------------- | ------- | -----------
**BestFitOutline** | An improved outline effect | UI / Effects / Extensions / Best Fit Outline | | Melang **BestFitOutline** | An improved outline effect | UI / Effects / Extensions / Best Fit Outline ||| Melang
**CurvedText** | A Text vertex manipulator for those users NOT using TextMeshPro (why ever not?) | UI / Effects / Extensons / Curved Text | | Breyer **CurvedText** | A Text vertex manipulator for those users NOT using TextMeshPro (why ever not?) | UI / Effects / Extensons / Curved Text ||| Breyer
**Gradient** | Apply vertex colours in a gradient on any UI object | UI / Effects / Extensions / Gradient | | Breyer **Gradient** | Apply vertex colours in a gradient on any UI object | UI / Effects / Extensions / Gradient ||| Breyer
**LetterSpacing** | Allows finers control of text spacing | UI / Effects / Extensions / Letter Spacing | | Deeperbeige **LetterSpacing** | Allows finers control of text spacing | UI / Effects / Extensions / Letter Spacing ||| Deeperbeige
**NicerOutline** | Another outline control | UI / Effects / Extensions / Nicer Outline | | Melang **NicerOutline** | Another outline control | UI / Effects / Extensions / Nicer Outline ||| Melang
**RaycastMask** | An example of an enhanced mask component able to work with the image data. Enables picking on image parts and not just the Rect Transform | UI / Effects / Extensions / Raycast Mask | | senritsu **RaycastMask** | An example of an enhanced mask component able to work with the image data. Enables picking on image parts and not just the Rect Transform | UI / Effects / Extensions / Raycast Mask ||| senritsu
**UIFlippable** | Image component effect to flip the graphic | UI / Effects / Extensions / UI Flippable | | ChoMPHi **UIFlippable** | Image component effect to flip the graphic | UI / Effects / Extensions / UI Flippable ||| ChoMPHi
**UIImageCrop** | Shader based mask system which clips to specific ranges X&Y | UI / Effects / Extensions / UI Image Crop ||| 00christian00
**SoftAlphaMask** | Shader based mask able to clip images using an alpha mask | UI / Effects / Extensions / Soft Mask Script ||| NemoKrad
## VR Components## ## VR Components##
======================= =======================
Component | Description | Component Command | Notes | Credits Component | Description | Component Command | Notes | Donate | Credits
--------- | -------------- | ---------------------------- | ------- | ------ --------- | -------------- | ---------------------------- | ------- | ------
**VRCursor** | Cursor script for VR use (requires VRInputModule) | UI / Extensions / VR Cursoe | | Ralph Barbagallo **VRCursor** | Cursor script for VR use (requires VRInputModule) | UI / Extensions / VR Cursoe ||| Ralph Barbagallo
**VRInputModule** | Input module to support the VR Cursor | Event / Vr Input Module | | Ralph Barbagallo **VRInputModule** | Input module to support the VR Cursor | Event / Vr Input Module ||| Ralph Barbagallo
## Input Modules ## ## Input Modules ##
======================= =======================
Component | Description | Component Command | Notes | Credits Component | Description | Component Command | Notes | Donate | Credits
--------- | -------------- | ---------------------------- | ------- | ------ --------- | -------------- | ---------------------------- | ------- | ------
**AimerInputModule** | Replacement Input module to allow for a reciclue to interace with WorldSpace canvas UI | Event / Extensions / Aimer Input Module | | Chris Trueman **AimerInputModule** | Replacement Input module to allow for a reciclue to interace with WorldSpace canvas UI | Event / Extensions / Aimer Input Module ||| Chris Trueman
**GamePadInputModule** | Stripped down SIM Input module for just gamepad/keybord input | Event / Extensions / GamePad Input Module | | Simon (darkside) Jackson **GamePadInputModule** | Stripped down SIM Input module for just gamepad/keybord input | Event / Extensions / GamePad Input Module ||| Simon (darkside) Jackson
## Additional Components## ## Additional Components##
======================= =======================
Component | Description | Component Command | Notes | Credits Component | Description | Component Command | Notes | Donate | Credits
--------- | -------------- | ---------------------------- | ------- | ------ --------- | -------------- | ---------------------------- | ------- | ------
**ReturnKeyTrigger** | Does something?? | UI / Extensions / ReturnKey Trigger | | Melang, ddreaper **ReturnKeyTrigger** | Does something?? | UI / Extensions / ReturnKey Trigger ||| Melang, ddreaper
**TabNavigation** | An example Tab navigation script, updated to add manual navigation | UI / Extensions / Tab Navigation | | Melang, omatase **TabNavigation** | An example Tab navigation script, updated to add manual navigation | UI / Extensions / Tab Navigation ||| Melang, omatase
**uGUITools** | | Menu / uGUI | | Senshi **uGUITools** | | Menu / uGUI ||| Senshi
**ScrollRectTweener** | Tweening solution for ScrollRects, add smoothing automatically | UI / Extensions / ScrollRectTweener | | Martin Sharkbomb **ScrollRectTweener** | Tweening solution for ScrollRects, add smoothing automatically | UI / Extensions / ScrollRectTweener ||| Martin Sharkbomb
**ScrollRectLinker** | ScrollRect Linker script, enable multiple ScrollRects to move together | UI / Extensions / ScrollRectLinker | | Martin Sharkbomb **ScrollRectLinker** | ScrollRect Linker script, enable multiple ScrollRects to move together | UI / Extensions / ScrollRectLinker ||| Martin Sharkbomb
**ScrollRectEx** | Improved ScrollRect control, enables support for Nested ScrollRects | UI / Extensions / ScrollRectEx | | CaptainSchnittchen, GamesRUs **ScrollRectEx** | Improved ScrollRect control, enables support for Nested ScrollRects | UI / Extensions / ScrollRectEx ||| CaptainSchnittchen, GamesRUs
**InputFocus** | Enhanced InputField control for forms, enables Enter to submit and other features | UI / Extensions / InputFocus | | Zelek **InputFocus** | Enhanced InputField control for forms, enables Enter to submit and other features | UI / Extensions / InputFocus ||| Zelek
**ImageExtended** | Improved Image control with rotation support and use of filled type without an Image (useful for masks) | UI / Extensions / Image Extended | | Ges **ImageExtended** | Improved Image control with rotation support and use of filled type without an Image (useful for masks) | UI / Extensions / Image Extended ||| Ges
**UIScrollToSelection** | Enables a ScrollRect to scroll based on the selected child automatically | UI / Extensions / UIScrollToSelection | | zero3growlithe **UIScrollToSelection** | Enables a ScrollRect to scroll based on the selected child automatically | UI / Extensions / UIScrollToSelection ||| zero3growlithe
**UISelectableExtension** | Refactor of original UI Button control, can now add Press/Release and Hold events to any Selectable control | UI / Extensions / UI Selectable Extension | | AriathTheWise / Simon Jackson **UISelectableExtension** | Refactor of original UI Button control, can now add Press/Release and Hold events to any Selectable control | UI / Extensions / UI Selectable Extension ||| AriathTheWise / Simon Jackson
**switchToRectTransform** | RectTransform extension method to move one Rect to another | N/A | | Izitmee **switchToRectTransform** | RectTransform extension method to move one Rect to another | N/A ||| Izitmee
*More to come* *More to come*
======================= =======================
### How do I get set up? ### ### How do I get set up? ###
Either clone / download this repository to your machine and then copy the scripts in, or use the pre-packaged .UnityPackage for your version of Unity and import it as a custom package in to your project. Either clone / download this repository to your machine and then copy the scripts in, or use the pre-packaged .UnityPackage for your version of Unity and import it as a custom package in to your project.
### Contribution guidelines ### ### Contribution guidelines ###
Got a script you want added, then just fork and submit a PR. All contributions accepted (including fixes) Got a script you want added, then just fork and submit a PR. All contributions accepted (including fixes)
Just ensure Just ensure
* The header of the script matches the standard used in all scripts * The header of the script matches the standard used in all scripts
@ -164,7 +166,6 @@ Just ensure
All scripts conform to the BSD license and are free to use / distribute. See the [LICENSE](https://bitbucket.org/ddreaper/unity-ui-extensions/src/6d03f25b0150994afa97c6a55854d6ae696cad13/LICENSE?at=default) file for more information All scripts conform to the BSD license and are free to use / distribute. See the [LICENSE](https://bitbucket.org/ddreaper/unity-ui-extensions/src/6d03f25b0150994afa97c6a55854d6ae696cad13/LICENSE?at=default) file for more information
### Like what you see? ### ### Like what you see? ###
All these scripts were put together for my latest book Unity3D UI Essentials All these scripts were put together for my latest book Unity3D UI Essentials
Check out the [page on my blog](http://bit.ly/Unity3DUIEssentials) for more details and learn all about the inner workings of the new Unity UI System. Check out the [page on my blog](http://bit.ly/Unity3DUIEssentials) for more details and learn all about the inner workings of the new Unity UI System.

View File

@ -207,7 +207,7 @@ namespace UnityEditor.UI
#region UI Extensions "Create" Menu items #region UI Extensions "Create" Menu items
#region Scroll Snap controls #region Scroll Snap controls
[MenuItem("GameObject/UI/Extensions/Horizontal Scroll Snap", false)] [MenuItem("GameObject/UI/Extensions/Horizontal Scroll Snap", false)]
static public void AddHorizontalScrollSnap(MenuCommand menuCommand) static public void AddHorizontalScrollSnap(MenuCommand menuCommand)
{ {
GameObject horizontalScrollSnapRoot = CreateUIElementRoot("Horizontal Scroll Snap", menuCommand, s_ThickGUIElementSize); GameObject horizontalScrollSnapRoot = CreateUIElementRoot("Horizontal Scroll Snap", menuCommand, s_ThickGUIElementSize);
@ -272,7 +272,7 @@ namespace UnityEditor.UI
Selection.activeGameObject = horizontalScrollSnapRoot; Selection.activeGameObject = horizontalScrollSnapRoot;
} }
[MenuItem("GameObject/UI/Extensions/Vertical Scroll Snap", false)] [MenuItem("GameObject/UI/Extensions/Vertical Scroll Snap", false)]
static public void AddVerticallScrollSnap(MenuCommand menuCommand) static public void AddVerticallScrollSnap(MenuCommand menuCommand)
{ {
GameObject verticalScrollSnapRoot = CreateUIElementRoot("Vertical Scroll Snap", menuCommand, s_ThickGUIElementSize); GameObject verticalScrollSnapRoot = CreateUIElementRoot("Vertical Scroll Snap", menuCommand, s_ThickGUIElementSize);
@ -537,7 +537,7 @@ namespace UnityEditor.UI
Selection.activeGameObject = go; Selection.activeGameObject = go;
} }
#endregion #endregion
#region Drop Down controls #region Drop Down controls
[MenuItem("GameObject/UI/Extensions/AutoComplete ComboBox", false)] [MenuItem("GameObject/UI/Extensions/AutoComplete ComboBox", false)]
@ -579,7 +579,7 @@ namespace UnityEditor.UI
inputFieldRT.anchorMin = Vector2.zero; inputFieldRT.anchorMin = Vector2.zero;
inputFieldRT.anchorMax = Vector2.one; inputFieldRT.anchorMax = Vector2.one;
inputFieldRT.sizeDelta = Vector2.zero; inputFieldRT.sizeDelta = Vector2.zero;
Events.UnityEventTools.AddPersistentListener<string>(inputField.GetComponent<InputField>().onValueChange, new UnityEngine.Events.UnityAction<string>(autoCompleteComboBox.OnValueChanged)); Events.UnityEventTools.AddPersistentListener<string>(inputField.GetComponent<InputField>().onValueChanged, new UnityEngine.Events.UnityAction<string>(autoCompleteComboBox.OnValueChanged));
//Setup Overlay //Setup Overlay
var overlayRT = overlay.GetComponent<RectTransform>(); var overlayRT = overlay.GetComponent<RectTransform>();
@ -675,7 +675,7 @@ namespace UnityEditor.UI
inputFieldRT.anchorMin = Vector2.zero; inputFieldRT.anchorMin = Vector2.zero;
inputFieldRT.anchorMax = Vector2.one; inputFieldRT.anchorMax = Vector2.one;
inputFieldRT.sizeDelta = Vector2.zero; inputFieldRT.sizeDelta = Vector2.zero;
Events.UnityEventTools.AddPersistentListener<string>(inputField.GetComponent<InputField>().onValueChange, new UnityEngine.Events.UnityAction<string>(comboBox.OnValueChanged)); Events.UnityEventTools.AddPersistentListener<string>(inputField.GetComponent<InputField>().onValueChanged, new UnityEngine.Events.UnityAction<string>(comboBox.OnValueChanged));
//Setup Overlay //Setup Overlay
var overlayRT = overlay.GetComponent<RectTransform>(); var overlayRT = overlay.GetComponent<RectTransform>();
@ -863,7 +863,7 @@ namespace UnityEditor.UI
arrowTextCanvasGroup.blocksRaycasts = false; arrowTextCanvasGroup.blocksRaycasts = false;
Selection.activeGameObject = dropDownListRoot; Selection.activeGameObject = dropDownListRoot;
} }
#endregion #endregion
#region RTS Selection box #region RTS Selection box
[MenuItem("GameObject/UI/Extensions/Selection Box", false)] [MenuItem("GameObject/UI/Extensions/Selection Box", false)]
@ -897,7 +897,7 @@ namespace UnityEditor.UI
Selection.activeGameObject = go; Selection.activeGameObject = go;
} }
#endregion #endregion
#region Bound Tooltip #region Bound Tooltip
[MenuItem("GameObject/UI/Extensions/Bound Tooltip/Tooltip", false)] [MenuItem("GameObject/UI/Extensions/Bound Tooltip/Tooltip", false)]
@ -947,7 +947,7 @@ namespace UnityEditor.UI
} }
} }
#endregion #endregion
#region Progress bar #region Progress bar
[MenuItem("GameObject/UI/Extensions/Progress Bar", false)] [MenuItem("GameObject/UI/Extensions/Progress Bar", false)]
@ -994,7 +994,7 @@ namespace UnityEditor.UI
slider.direction = Slider.Direction.LeftToRight; slider.direction = Slider.Direction.LeftToRight;
SetDefaultColorTransitionValues(slider); SetDefaultColorTransitionValues(slider);
} }
#endregion #endregion
#region Primitives #region Primitives
@ -1037,7 +1037,7 @@ namespace UnityEditor.UI
go.AddComponent<UICornerCut>(); go.AddComponent<UICornerCut>();
Selection.activeGameObject = go; Selection.activeGameObject = go;
} }
#endregion #endregion
#region Re-Orderable Lists #region Re-Orderable Lists

5
Scripts/Effects.meta Normal file
View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: cbbc72115bdf3fe4a93d8566634c6e61
folderAsset: yes
DefaultImporter:
userData:

View File

@ -0,0 +1,164 @@
/// Credit NemoKrad (aka Charles Humphrey)
/// Sourced from - http://www.randomchaos.co.uk/SoftAlphaUIMask.aspx
namespace UnityEngine.UI.Extensions
{
[ExecuteInEditMode]
[AddComponentMenu("UI/Effects/Extensions/SoftMaskScript")]
public class SoftMaskScript : MonoBehaviour
{
Material mat;
Canvas canvas;
[Tooltip("The area that is to be used as the container.")]
public RectTransform MaskArea;
RectTransform myRect;
[Tooltip("Texture to be used to do the soft alpha")]
public Texture AlphaMask;
[Tooltip("At what point to apply the alpha min range 0-1")]
[Range(0, 1)]
public float CutOff = 0;
[Tooltip("Implement a hard blend based on the Cutoff")]
public bool HardBlend = false;
Vector3[] worldCorners;
Vector2 AlphaUV;
Vector2 min;
Vector2 max = Vector2.one;
Vector2 p;
Vector2 siz;
Rect maskRect;
Rect contentRect;
Vector2 centre;
bool isText = false;
// Use this for initialization
void Start()
{
myRect = GetComponent<RectTransform>();
if (!MaskArea)
{
MaskArea = myRect;
}
if (GetComponent<Graphic>() != null)
{
mat = new Material(Shader.Find("UI Extensions/SoftMaskShader"));
GetComponent<Graphic>().material = mat;
}
if (GetComponent<Text>())
{
isText = true;
mat = new Material(Shader.Find("UI Extensions/SoftMaskShaderText"));
GetComponent<Text>().material = mat;
GetCanvas();
// For some reason, having the mask control on the parent and disabled stops the mouse interacting
// with the texture layer that is not visible.. Not needed for the Image.
if (transform.parent.GetComponent<Mask>() == null)
transform.parent.gameObject.AddComponent<Mask>();
transform.parent.GetComponent<Mask>().enabled = false;
}
}
void GetCanvas()
{
Transform t = transform;
int lvlLimit = 100;
int lvl = 0;
while (canvas == null && lvl < lvlLimit)
{
canvas = t.gameObject.GetComponent<Canvas>();
if (canvas == null)
t = GetParentTranform(t);
lvl++;
}
}
Transform GetParentTranform(Transform t)
{
return t.parent;
}
void Update()
{
SetMask();
}
void SetMask()
{
// Get the two rectangle areas
maskRect = MaskArea.rect;
contentRect = myRect.rect;
if (isText) // Need to do our calculations in world for Text
{
if (canvas.renderMode == RenderMode.ScreenSpaceOverlay && Application.isPlaying)
{
p = canvas.transform.InverseTransformPoint(MaskArea.transform.position);
siz = new Vector2(maskRect.width, maskRect.height);
}
else
{
worldCorners = new Vector3[4];
MaskArea.GetWorldCorners(worldCorners);
siz = (worldCorners[2] - worldCorners[0]);
p = MaskArea.transform.position;
}
min = p - (new Vector2(siz.x, siz.y) * .5f);
max = p + (new Vector2(siz.x, siz.y) * .5f);
}
else // Need to do our calculations in tex space for Image.
{
// Get the centre offset
centre = myRect.transform.InverseTransformPoint(MaskArea.transform.position);
// Set the scale for mapping texcoords mask
AlphaUV = new Vector2(maskRect.width / contentRect.width, maskRect.height / contentRect.height);
// set my min and max to the centre offest
min = centre;
max = min;
siz = new Vector2(maskRect.width, maskRect.height) * .5f;
// Move them out to the min max extreams
min -= siz;
max += siz;
// Now move these into texture space. 0 - 1
min = new Vector2(min.x / contentRect.width, min.y / contentRect.height) + new Vector2(.5f, .5f);
max = new Vector2(max.x / contentRect.width, max.y / contentRect.height) + new Vector2(.5f, .5f);
}
mat.SetFloat("_HardBlend", HardBlend ? 1 : 0);
// Pass the values to the shader
mat.SetVector("_Min", min);
mat.SetVector("_Max", max);
mat.SetTexture("_AlphaMask", AlphaMask);
if (!isText) // No mod needed for Text
mat.SetVector("_AlphaUV", AlphaUV);
mat.SetFloat("_CutOff", CutOff);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b8ee60af491978345bc197ed4e1316bc
timeCreated: 1448034177
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,70 @@
/// Credit 00christian00
/// Sourced from - http://forum.unity3d.com/threads/any-way-to-show-part-of-an-image-without-using-mask.360085/#post-2332030
namespace UnityEngine.UI.Extensions
{
[AddComponentMenu("UI/Effects/Extensions/UIImageCrop")]
[ExecuteInEditMode]
[RequireComponent(typeof(RectTransform))]
public class UIImageCrop : MonoBehaviour
{
MaskableGraphic mGraphic;
Material mat;
int XCropProperty, YCropProperty;
public float XCrop = 0f;
public float YCrop = 0f;
// Use this for initialization
void Start()
{
SetMaterial();
}
public void SetMaterial()
{
mGraphic = this.GetComponent<MaskableGraphic>();
XCropProperty = Shader.PropertyToID("_XCrop");
YCropProperty = Shader.PropertyToID("_YCrop");
if (mGraphic != null)
{
if (mGraphic.material == null || mGraphic.material.name == "Default UI Material")
{
//Applying default material with UI Image Crop shader
mGraphic.material = new Material(Shader.Find("UI Extensions/UI Image Crop"));
}
mat = mGraphic.material;
}
else
{
Debug.LogError("Please attach component to a Graphical UI component");
}
}
public void OnValidate()
{
SetMaterial();
SetXCrop(XCrop);
SetYCrop(YCrop);
}
/// <summary>
/// Set the x crop factor, with x being a normalized value 0-1f.
/// </summary>
/// <param name="xcrop"></param>
public void SetXCrop(float xcrop)
{
XCrop = Mathf.Clamp01(xcrop);
mat.SetFloat(XCropProperty, XCrop);
}
/// <summary>
/// Set the y crop factor, with y being a normalized value 0-1f.
/// </summary>
/// <param name="ycrop"></param>
public void SetYCrop(float ycrop)
{
YCrop = Mathf.Clamp01(ycrop);
mat.SetFloat(YCropProperty, YCrop);
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 022c3983095dce44c9504739a8ed7324
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -74,7 +74,7 @@ namespace UnityEngine.UI.Extensions
public Button prevButton; public Button prevButton;
[Tooltip("Number of items visible in one page of scroll frame.")] [Tooltip("Number of items visible in one page of scroll frame.")]
[RangeAttribute(1,100)] [RangeAttribute(1, 100)]
public int itemsVisibleAtOnce = 1; public int itemsVisibleAtOnce = 1;
[Tooltip("Sets minimum width of list items to 1/itemsVisibleAtOnce.")] [Tooltip("Sets minimum width of list items to 1/itemsVisibleAtOnce.")]
@ -121,14 +121,18 @@ namespace UnityEngine.UI.Extensions
if (nextButton) if (nextButton)
{ {
nextButton.GetComponent<Button>().onClick.AddListener(() => { nextButton.GetComponent<Button>().onClick.AddListener(() =>
NextScreen(); }); {
NextScreen();
});
} }
if (prevButton) if (prevButton)
{ {
prevButton.GetComponent<Button>().onClick.AddListener(() => { prevButton.GetComponent<Button>().onClick.AddListener(() =>
PreviousScreen(); }); {
PreviousScreen();
});
} }
} }
@ -165,7 +169,7 @@ namespace UnityEngine.UI.Extensions
{ {
foreach (var tr in listContainerTransform) foreach (var tr in listContainerTransform)
{ {
GameObject child = ((Transform) tr).gameObject; GameObject child = ((Transform)tr).gameObject;
if (child.activeInHierarchy) if (child.activeInHierarchy)
{ {
var childLayout = child.GetComponent<LayoutElement>(); var childLayout = child.GetComponent<LayoutElement>();
@ -183,7 +187,7 @@ namespace UnityEngine.UI.Extensions
{ {
foreach (var tr in listContainerTransform) foreach (var tr in listContainerTransform)
{ {
GameObject child = ((Transform) tr).gameObject; GameObject child = ((Transform)tr).gameObject;
if (child.activeInHierarchy) if (child.activeInHierarchy)
{ {
var childLayout = child.GetComponent<LayoutElement>(); var childLayout = child.GetComponent<LayoutElement>();
@ -209,7 +213,7 @@ namespace UnityEngine.UI.Extensions
foreach (var tr in listContainerTransform) foreach (var tr in listContainerTransform)
{ {
if (((Transform) tr).gameObject.activeInHierarchy) if (((Transform)tr).gameObject.activeInHierarchy)
{ {
activeCount++; activeCount++;
} }
@ -225,7 +229,6 @@ namespace UnityEngine.UI.Extensions
if (direction == ScrollDirection.Horizontal) if (direction == ScrollDirection.Horizontal)
{ {
//Debug.Log ("-------------looking for list spanning range----------------");
// looking for list spanning range min/max // looking for list spanning range min/max
scrollRect.horizontalNormalizedPosition = 0; scrollRect.horizontalNormalizedPosition = 0;
listContainerMaxPosition = listContainerTransform.localPosition.x; listContainerMaxPosition = listContainerTransform.localPosition.x;
@ -233,10 +236,8 @@ namespace UnityEngine.UI.Extensions
listContainerMinPosition = listContainerTransform.localPosition.x; listContainerMinPosition = listContainerTransform.localPosition.x;
listContainerSize = listContainerMaxPosition - listContainerMinPosition; listContainerSize = listContainerMaxPosition - listContainerMinPosition;
//itemSize = pages > 1 ? listContainerSize / (float)(pages - 1) : listContainerSize / activeCount;
//itemSize *= (pages + itemsVisibleAtOnce) / (pages + 1);
for (var i = 0; i < pages; i ++) for (var i = 0; i < pages; i++)
{ {
pageAnchorPositions[i] = new Vector3( pageAnchorPositions[i] = new Vector3(
listContainerMaxPosition - itemSize * i, listContainerMaxPosition - itemSize * i,
@ -244,8 +245,6 @@ namespace UnityEngine.UI.Extensions
listContainerTransform.localPosition.z listContainerTransform.localPosition.z
); );
} }
//Debug.Log (String.Format("min:{0:0.0}, max:{1:0.0}, pages: {2:0}, width: {3:0}", listContainerMinPosition, listContainerMaxPosition, pages, listContainerSize/pages));
} }
else else
{ {
@ -257,20 +256,15 @@ namespace UnityEngine.UI.Extensions
listContainerMaxPosition = listContainerTransform.localPosition.y; listContainerMaxPosition = listContainerTransform.localPosition.y;
listContainerSize = listContainerMaxPosition - listContainerMinPosition; listContainerSize = listContainerMaxPosition - listContainerMinPosition;
//itemSize = pages > 1 ? listContainerSize / (float)(pages - 1) : listContainerSize / activeCount;
//itemSize *= (pages + itemsVisibleAtOnce) / (pages + 1);
for (var i = 0; i < pages; i ++) for (var i = 0; i < pages; i++)
{ {
pageAnchorPositions[i] = new Vector3( pageAnchorPositions[i] = new Vector3(
listContainerTransform.localPosition.x, listContainerTransform.localPosition.x,
listContainerMinPosition + itemSize * i, listContainerMinPosition + itemSize * i,
listContainerTransform.localPosition.z listContainerTransform.localPosition.z
); );
//Debug.Log (String.Format("pos[{0:0}]={1} {2:0%}", i, pageAnchorPositions[i], pages > 1 ? i/(float)(pages-1) : (float)i));
} }
//Debug.Log (String.Format("min:{0:0.0}, max:{1:0.0}, pages: {2:0}, width: {3:0}", listContainerMinPosition, listContainerMaxPosition, pages, listContainerSize/pages));
} }
UpdateScrollbar(linkScrolbarSteps); UpdateScrollbar(linkScrolbarSteps);
@ -293,11 +287,11 @@ namespace UnityEngine.UI.Extensions
{ {
if (direction == ScrollDirection.Horizontal) if (direction == ScrollDirection.Horizontal)
{ {
scrollRect.horizontalNormalizedPosition = pages > 1 ? (float) startingPage / (float) (pages - 1) : 0; scrollRect.horizontalNormalizedPosition = pages > 1 ? (float)startingPage / (float)(pages - 1) : 0;
} }
else else
{ {
scrollRect.verticalNormalizedPosition = pages > 1 ? (float) (pages - startingPage - 1) / (float) (pages - 1) : 0; scrollRect.verticalNormalizedPosition = pages > 1 ? (float)(pages - startingPage - 1) / (float)(pages - 1) : 0;
} }
} }
@ -356,8 +350,6 @@ namespace UnityEngine.UI.Extensions
lerp = false; lerp = false;
UpdateScrollbar(linkScrolbarSteps); UpdateScrollbar(linkScrolbarSteps);
//Debug.Log(String.Format("Lerp: {0}/{1} page: {2:0}", lerpTarget, listContainerTransform.localPosition, CurrentPage()));
} }
//change the info bullets at the bottom of the screen. Just for visual effect //change the info bullets at the bottom of the screen. Just for visual effect
@ -371,8 +363,6 @@ namespace UnityEngine.UI.Extensions
{ {
fastSwipeCounter++; fastSwipeCounter++;
} }
//Debug.Log(String.Format("Update: {0}", listContainerTransform.localPosition));
} }
private bool fastSwipe = false; //to determine if a fast swipe was performed private bool fastSwipe = false; //to determine if a fast swipe was performed
@ -453,8 +443,6 @@ namespace UnityEngine.UI.Extensions
float page = pos / itemSize; float page = pos / itemSize;
//Debug.Log (String.Format("min:{0:0.0}, max:{1:0.0}, current:{2:0.0}/{4:0.0}, page:{3:0.0}, target:{5}", listContainerMinPosition, listContainerMaxPosition, pos, page, listContainerTransform.localPosition.x, pageAnchorPositions[Mathf.RoundToInt(page)]));
return Mathf.Clamp(Mathf.RoundToInt(page), 0, pages); return Mathf.Clamp(Mathf.RoundToInt(page), 0, pages);
} }
@ -501,8 +489,6 @@ namespace UnityEngine.UI.Extensions
positionOnDragStart = eventData.position; positionOnDragStart = eventData.position;
pageOnDragStart = CurrentPage(); pageOnDragStart = CurrentPage();
//Debug.Log (String.Format("pageOnDragStart:{0:0}", pageOnDragStart));
} }
public void OnEndDrag(PointerEventData eventData) public void OnEndDrag(PointerEventData eventData)

5
Shaders.meta Normal file
View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 0873351fdb3a65f43901b3ec088375b0
folderAsset: yes
DefaultImporter:
userData:

View File

@ -0,0 +1,155 @@
Shader "UI Extensions/SoftMaskShader"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_Color("Tint", Color) = (1,1,1,1)
_StencilComp("Stencil Comparison", Float) = 8
_Stencil("Stencil ID", Float) = 0
_StencilOp("Stencil Operation", Float) = 0
_StencilWriteMask("Stencil Write Mask", Float) = 255
_StencilReadMask("Stencil Read Mask", Float) = 255
_ColorMask("Color Mask", Float) = 15
_Min("Min",Vector) = (0,0,0,0)
_Max("Max",Vector) = (1,1,0,0)
_AlphaMask("AlphaMask - Must be Wrapped",2D) = "white"{}
_AlphaUV("AlphaUV",Vector) = (0,0,0,0)
_CutOff("CutOff",Float) = 0
[MaterialToggle]
_HardBlend("HardBlend",Float) = 0
}
SubShader
{
Tags
{
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
Stencil
{
Ref[_Stencil]
Comp[_StencilComp]
Pass[_StencilOp]
ReadMask[_StencilReadMask]
WriteMask[_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest[unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask[_ColorMask]
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
half2 texcoord : TEXCOORD0;
float4 worldPosition : TEXCOORD1;
};
inline float UnityGet2DClipping (in float2 position, in float4 clipRect)
{
float2 inside = step(clipRect.xy, position.xy) * step(position.xy, clipRect.zw);
return inside.x * inside.y;
}
fixed4 _Color;
fixed4 _TextureSampleAdd;
bool _UseClipRect;
float4 _ClipRect;
bool _UseAlphaClip;
float4 _ProgressColor;
float _Value;
int _LeftToRight;
v2f vert(appdata_t IN)
{
v2f OUT;
OUT.worldPosition = IN.vertex;
OUT.vertex = mul(UNITY_MATRIX_MVP, OUT.worldPosition);
OUT.texcoord = IN.texcoord;
#ifdef UNITY_HALF_TEXEL_OFFSET
OUT.vertex.xy += (_ScreenParams.zw - 1.0)*float2(-1,1);
#endif
OUT.color = IN.color * _Color;
return OUT;
}
sampler2D _MainTex;
sampler2D _AlphaMask;
float2 _AlphaUV;
float2 _Min;
float2 _Max;
float _CutOff;
bool _HardBlend = false;
fixed4 frag(v2f IN) : SV_Target
{
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
// Do we want to clip the image to the Mask Rectangle?
if (IN.texcoord.x < _Min.x || IN.texcoord.x > _Max.x || IN.texcoord.y < _Min.y || IN.texcoord.y > _Max.y) // Yes we do
color.a = 0;
else // It's in the mask rectangle, so apply the alpha of the mask provided.
{
float a = tex2D(_AlphaMask, (IN.texcoord - _Min) / _AlphaUV).a;
if (a <= _CutOff)
a = 0;
else
{
if(_HardBlend)
a = 1;
}
color.a = a;
}
if (_UseClipRect)
color *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
if (_UseAlphaClip)
clip(color.a - 0.001);
return color;
}
ENDCG
}
}
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 947afae4d36f1274ea2e4098262ceef6
timeCreated: 1444851202
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,156 @@
Shader "UI Extensions/SoftMaskShaderText"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_Color("Tint", Color) = (1,1,1,1)
_StencilComp("Stencil Comparison", Float) = 8
_Stencil("Stencil ID", Float) = 0
_StencilOp("Stencil Operation", Float) = 0
_StencilWriteMask("Stencil Write Mask", Float) = 255
_StencilReadMask("Stencil Read Mask", Float) = 255
_ColorMask("Color Mask", Float) = 15
_Min("Min",Vector) = (0,0,0,0)
_Max("Max",Vector) = (1,1,0,0)
_AlphaMask("AlphaMask - Must be Wrapped",2D) = "white"{}
_CutOff("CutOff",Float) = 0
[MaterialToggle]
_HardBlend("HardBlend",Float) = 0
}
SubShader
{
Tags
{
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
Stencil
{
Ref[_Stencil]
Comp[_StencilComp]
Pass[_StencilOp]
ReadMask[_StencilReadMask]
WriteMask[_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest[unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
ColorMask[_ColorMask]
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
half2 texcoord : TEXCOORD0;
float4 worldPosition : TEXCOORD1;
float4 worldPosition2 : COLOR1;
};
inline float UnityGet2DClipping (in float2 position, in float4 clipRect)
{
float2 inside = step(clipRect.xy, position.xy) * step(position.xy, clipRect.zw);
return inside.x * inside.y;
}
fixed4 _Color;
fixed4 _TextureSampleAdd;
bool _UseClipRect;
float4 _ClipRect;
bool _UseAlphaClip;
float4 _ProgressColor;
float _Value;
int _LeftToRight;
bool _HardBlend = false;
v2f vert(appdata_t IN)
{
v2f OUT;
OUT.worldPosition = IN.vertex;
OUT.vertex = mul(UNITY_MATRIX_MVP, OUT.worldPosition);
OUT.worldPosition2 = mul(_Object2World, IN.vertex);
OUT.texcoord = IN.texcoord;
#ifdef UNITY_HALF_TEXEL_OFFSET
OUT.vertex.xy += (_ScreenParams.zw - 1.0)*float2(-1,1);
OUT.worldPosition2 += (_ScreenParams.zw - 1.0)*float2(-1, 1);
#endif
OUT.color = IN.color * _Color;
return OUT;
}
sampler2D _MainTex;
sampler2D _AlphaMask;
float2 _Min;
float2 _Max;
float2 _Mul;
float _CutOff;
fixed4 frag(v2f IN) : SV_Target
{
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
// Do we want to clip the image to the Mask Rectangle?
if (IN.worldPosition2.x <= _Min.x || IN.worldPosition2.x >= _Max.x || IN.worldPosition2.y <= _Min.y || IN.worldPosition2.y >= _Max.y)
color.a = 0;
else // It's in the mask rectangle, so apply the alpha of the mask provided.
{
float a = tex2D(_AlphaMask, (IN.worldPosition2.xy - _Max) / (_Max-_Min)).a;
if (a <= _CutOff)
a = 0;
else
{
if (_HardBlend)
a = 1;
}
color.a = a * color.a;
}
if (_UseClipRect)
color *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
if (_UseAlphaClip)
clip(color.a - 0.001);
return color;
}
ENDCG
}
}
}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: abe89b015c410b54db04a4842127ae9e
timeCreated: 1445628990
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,67 @@
/// Credit 00christian00
/// Sourced from - http://forum.unity3d.com/threads/any-way-to-show-part-of-an-image-without-using-mask.360085/#post-2332030
Shader "UI Extensions/UI Image Crop" {
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_XCrop ("X Crop", Range(0.0,1.0)) = 1
_YCrop ("Y Crop", Range(0.0,1.0)) = 1
}
SubShader {
ZWrite Off
Tags
{
"Queue" = "Transparent"
"RenderType" = "Transparent"
"IgnoreProjector" = "True"
}
Blend SrcAlpha OneMinusSrcAlpha
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct v2f {
float4 pos : POSITION;
fixed4 color : COLOR;
float2 uv : TEXCOORD0; //UV1 coord
};
uniform sampler2D _MainTex;
float4 _MainTex_ST;
uniform float _XCrop;
uniform float _YCrop;
v2f vert (v2f v)
{
v2f o;
o.color=v.color;
o.color.a=0.1;
o.pos = mul (UNITY_MATRIX_MVP, v.pos);
o.uv=TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : COLOR
{
//return fixed4(0.25,0,0,1);
i.color.a=step(i.uv.x,_XCrop);
//I don't like the bottom up ordering,so I reverse it
i.color.a=i.color.a*step(1-i.uv.y,_YCrop);
return i.color * tex2D (_MainTex, i.uv);
}
ENDCG
}
}
}

View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: ccf5a0c8f87d3c547aff3daecb3164a4
ShaderImporter:
defaultTextures: []
userData:

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,11 +1,11 @@
{ {
"name": "Unity UI Extensions", "name": "Unity UI Extensions",
"version": "1.0.5", "version": "1.0.6",
"description": "An extension project for the Unity3D UI system, all crafted and contributed by the awesome Unity community", "description": "An extension project for the Unity3D UI system, all crafted and contributed by the awesome Unity community",
"author": "Simon darkside Jackson <@SimonDarksideJ>", "author": "Simon darkside Jackson <@SimonDarksideJ>",
"contributors": [{ "contributors": [{
"name": "Foo Bar", "name": "SimonDarksideJ",
"email": "foo.bar@example.com" "twitter": "@SimonDarksideJ"
}], }],
"repository": { "repository": {
"type": "hg", "type": "hg",
@ -15,9 +15,10 @@
"url": "https://bitbucket.org/ddreaper/unity-ui-extensions/issues" "url": "https://bitbucket.org/ddreaper/unity-ui-extensions/issues"
}, },
"keywords": [ "keywords": [
"nodejitsu", "Unity3D",
"example", "Unity",
"browsenpm" "Unity UI",
"UI Extensions"
], ],
"license": "BSD" "license": "BSD"
} }