diff --git a/README.md b/README.md index 5ae363e..214fc79 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,8 @@ 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) -#Updated for 5.2.1P+/5.3 - new asset 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## 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 ### [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.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### @@ -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") --- ## 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") - -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. -Update 1.0.6 -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. +###Update 1.0.6### +* 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. +* 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: ## @@ -46,114 +48,114 @@ Added a new version of the Scroll Snap control as an alternative to the fixed ve ## 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 - | | | 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 -**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 -**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 -**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 -**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 - | | | UI / Extensions / Bound Tooltip / Tooltip Trigger | | Martin Sharkbomb +**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 +**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 +**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 +**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 +**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 +**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 ## 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 -**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 -**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 +**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 +**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 +**UICornerCut** | Graphic control for drawing a diamond in the UI System | UI/Extensions/Primitives/Cut Corners | UI/Extensions/Primitives/Cut Corners ||| Freezy ## 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 -**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 -**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 -**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 Vertical Single 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 -|| 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 Vertical List||| Ziboo -|| UI/Extensions/Re-orderable Lists/Re-orderable Hirizontal List||| Ziboo -|| UI/Extensions/Re-orderable Lists/Re-orderable Grid||| Ziboo +**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 +**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 +**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 +|| 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 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 +|| 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 Vertical List|||| Ziboo +|| UI/Extensions/Re-orderable Lists/Re-orderable Hirizontal List|||| Ziboo +|| UI/Extensions/Re-orderable Lists/Re-orderable Grid|||| Ziboo ## 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 -**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 -**LetterSpacing** | Allows finers control of text spacing | UI / Effects / Extensions / Letter Spacing | | Deeperbeige -**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 -**UIFlippable** | Image component effect to flip the graphic | UI / Effects / Extensions / UI Flippable | | ChoMPHi +**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 +**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 +**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 +**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## ======================= -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 -**VRInputModule** | Input module to support the VR Cursor | Event / Vr Input Module | | 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 ## 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 -**GamePadInputModule** | Stripped down SIM Input module for just gamepad/keybord input | Event / Extensions / GamePad Input Module | | Simon (darkside) Jackson +**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 ## Additional Components## ======================= -Component | Description | Component Command | Notes | Credits +Component | Description | Component Command | Notes | Donate | Credits --------- | -------------- | ---------------------------- | ------- | ------ -**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 -**uGUITools** | | Menu / uGUI | | Senshi -**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 -**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 -**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 -**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 +**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 +**uGUITools** | | Menu / uGUI ||| Senshi +**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 +**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 +**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 +**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 *More to come* ======================= ### 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. ### Contribution guidelines ### - Got a script you want added, then just fork and submit a PR. All contributions accepted (including fixes) Just ensure * 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 ### Like what you see? ### - 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. diff --git a/Scripts/Editor/UIExtensionsMenuOptions.cs b/Scripts/Editor/UIExtensionsMenuOptions.cs index 38b8ff6..cbebdb5 100644 --- a/Scripts/Editor/UIExtensionsMenuOptions.cs +++ b/Scripts/Editor/UIExtensionsMenuOptions.cs @@ -157,7 +157,6 @@ namespace UnityEditor.UI GameObjectUtility.SetParentAndAlign(eventSystem, parent); esys = eventSystem.AddComponent(); eventSystem.AddComponent(); - eventSystem.AddComponent(); Undo.RegisterCreatedObjectUndo(eventSystem, "Create " + eventSystem.name); } @@ -208,7 +207,7 @@ namespace UnityEditor.UI #region UI Extensions "Create" Menu items #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) { GameObject horizontalScrollSnapRoot = CreateUIElementRoot("Horizontal Scroll Snap", menuCommand, s_ThickGUIElementSize); @@ -273,7 +272,7 @@ namespace UnityEditor.UI 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) { GameObject verticalScrollSnapRoot = CreateUIElementRoot("Vertical Scroll Snap", menuCommand, s_ThickGUIElementSize); @@ -538,7 +537,7 @@ namespace UnityEditor.UI Selection.activeGameObject = go; } -#endregion + #endregion #region Drop Down controls [MenuItem("GameObject/UI/Extensions/AutoComplete ComboBox", false)] @@ -864,7 +863,7 @@ namespace UnityEditor.UI arrowTextCanvasGroup.blocksRaycasts = false; Selection.activeGameObject = dropDownListRoot; } -#endregion + #endregion #region RTS Selection box [MenuItem("GameObject/UI/Extensions/Selection Box", false)] @@ -898,7 +897,7 @@ namespace UnityEditor.UI Selection.activeGameObject = go; } -#endregion + #endregion #region Bound Tooltip [MenuItem("GameObject/UI/Extensions/Bound Tooltip/Tooltip", false)] @@ -948,7 +947,7 @@ namespace UnityEditor.UI } } -#endregion + #endregion #region Progress bar [MenuItem("GameObject/UI/Extensions/Progress Bar", false)] @@ -995,7 +994,7 @@ namespace UnityEditor.UI slider.direction = Slider.Direction.LeftToRight; SetDefaultColorTransitionValues(slider); } -#endregion + #endregion #region Primitives @@ -1038,7 +1037,7 @@ namespace UnityEditor.UI go.AddComponent(); Selection.activeGameObject = go; } -#endregion + #endregion #region Re-Orderable Lists diff --git a/Scripts/Primatives.meta b/Scripts/Effects.meta similarity index 63% rename from Scripts/Primatives.meta rename to Scripts/Effects.meta index ab52354..a01b9d9 100644 --- a/Scripts/Primatives.meta +++ b/Scripts/Effects.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ce526e6e0c6202e4e9c5ee35dd79295d +guid: cbbc72115bdf3fe4a93d8566634c6e61 folderAsset: yes DefaultImporter: userData: diff --git a/Scripts/BestFitOutline.cs b/Scripts/Effects/BestFitOutline.cs similarity index 100% rename from Scripts/BestFitOutline.cs rename to Scripts/Effects/BestFitOutline.cs diff --git a/Scripts/BestFitOutline.cs.meta b/Scripts/Effects/BestFitOutline.cs.meta similarity index 100% rename from Scripts/BestFitOutline.cs.meta rename to Scripts/Effects/BestFitOutline.cs.meta diff --git a/Scripts/CurvedText.cs b/Scripts/Effects/CurvedText.cs similarity index 100% rename from Scripts/CurvedText.cs rename to Scripts/Effects/CurvedText.cs diff --git a/Scripts/CurvedText.cs.meta b/Scripts/Effects/CurvedText.cs.meta similarity index 100% rename from Scripts/CurvedText.cs.meta rename to Scripts/Effects/CurvedText.cs.meta diff --git a/Scripts/Gradient.cs b/Scripts/Effects/Gradient.cs similarity index 100% rename from Scripts/Gradient.cs rename to Scripts/Effects/Gradient.cs diff --git a/Scripts/Gradient.cs.meta b/Scripts/Effects/Gradient.cs.meta similarity index 100% rename from Scripts/Gradient.cs.meta rename to Scripts/Effects/Gradient.cs.meta diff --git a/Scripts/LetterSpacing.cs b/Scripts/Effects/LetterSpacing.cs similarity index 100% rename from Scripts/LetterSpacing.cs rename to Scripts/Effects/LetterSpacing.cs diff --git a/Scripts/LetterSpacing.cs.meta b/Scripts/Effects/LetterSpacing.cs.meta similarity index 100% rename from Scripts/LetterSpacing.cs.meta rename to Scripts/Effects/LetterSpacing.cs.meta diff --git a/Scripts/NicerOutline.cs b/Scripts/Effects/NicerOutline.cs similarity index 100% rename from Scripts/NicerOutline.cs rename to Scripts/Effects/NicerOutline.cs diff --git a/Scripts/NicerOutline.cs.meta b/Scripts/Effects/NicerOutline.cs.meta similarity index 100% rename from Scripts/NicerOutline.cs.meta rename to Scripts/Effects/NicerOutline.cs.meta diff --git a/Scripts/Effects/SoftMaskScript.cs b/Scripts/Effects/SoftMaskScript.cs new file mode 100644 index 0000000..57b9ed5 --- /dev/null +++ b/Scripts/Effects/SoftMaskScript.cs @@ -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(); + + if (!MaskArea) + { + MaskArea = myRect; + } + + if (GetComponent() != null) + { + mat = new Material(Shader.Find("UI Extensions/SoftMaskShader")); + GetComponent().material = mat; + } + + if (GetComponent()) + { + isText = true; + mat = new Material(Shader.Find("UI Extensions/SoftMaskShaderText")); + GetComponent().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() == null) + transform.parent.gameObject.AddComponent(); + + transform.parent.GetComponent().enabled = false; + } + } + + void GetCanvas() + { + Transform t = transform; + + int lvlLimit = 100; + int lvl = 0; + + while (canvas == null && lvl < lvlLimit) + { + canvas = t.gameObject.GetComponent(); + 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); + } + } +} \ No newline at end of file diff --git a/Scripts/Effects/SoftMaskScript.cs.meta b/Scripts/Effects/SoftMaskScript.cs.meta new file mode 100644 index 0000000..f9e28c2 --- /dev/null +++ b/Scripts/Effects/SoftMaskScript.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b8ee60af491978345bc197ed4e1316bc +timeCreated: 1448034177 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/UIFlippable.cs b/Scripts/Effects/UIFlippable.cs similarity index 100% rename from Scripts/UIFlippable.cs rename to Scripts/Effects/UIFlippable.cs diff --git a/Scripts/UIFlippable.cs.meta b/Scripts/Effects/UIFlippable.cs.meta similarity index 100% rename from Scripts/UIFlippable.cs.meta rename to Scripts/Effects/UIFlippable.cs.meta diff --git a/Scripts/Effects/UIImageCrop.cs b/Scripts/Effects/UIImageCrop.cs new file mode 100644 index 0000000..46c4065 --- /dev/null +++ b/Scripts/Effects/UIImageCrop.cs @@ -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(); + 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); + } + /// + /// Set the x crop factor, with x being a normalized value 0-1f. + /// + /// + public void SetXCrop(float xcrop) + { + XCrop = Mathf.Clamp01(xcrop); + mat.SetFloat(XCropProperty, XCrop); + } + + /// + /// Set the y crop factor, with y being a normalized value 0-1f. + /// + /// + public void SetYCrop(float ycrop) + { + YCrop = Mathf.Clamp01(ycrop); + mat.SetFloat(YCropProperty, YCrop); + } + } +} \ No newline at end of file diff --git a/Scripts/Effects/UIImageCrop.cs.meta b/Scripts/Effects/UIImageCrop.cs.meta new file mode 100644 index 0000000..ac959b0 --- /dev/null +++ b/Scripts/Effects/UIImageCrop.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 022c3983095dce44c9504739a8ed7324 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Scripts/Layout/ScrollSnap.cs b/Scripts/Layout/ScrollSnap.cs index 0b311fb..bb432b1 100644 --- a/Scripts/Layout/ScrollSnap.cs +++ b/Scripts/Layout/ScrollSnap.cs @@ -14,557 +14,543 @@ using UnityEngine.EventSystems; namespace UnityEngine.UI.Extensions { - [ExecuteInEditMode] - [RequireComponent(typeof(ScrollRect))] - [AddComponentMenu("UI/Extensions/Scroll Snap")] - public class ScrollSnap : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler - { - // needed becouse of reversed behavior of axis Y compared to X - // (positions of children lower in children list in horizontal directions grows when in vertical it gets smaller) - public enum ScrollDirection - { - Horizontal, - Vertical - } + [ExecuteInEditMode] + [RequireComponent(typeof(ScrollRect))] + [AddComponentMenu("UI/Extensions/Scroll Snap")] + public class ScrollSnap : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler + { + // needed becouse of reversed behavior of axis Y compared to X + // (positions of children lower in children list in horizontal directions grows when in vertical it gets smaller) + public enum ScrollDirection + { + Horizontal, + Vertical + } - public delegate void PageSnapChange(int page); + public delegate void PageSnapChange(int page); - public event PageSnapChange onPageChange; + public event PageSnapChange onPageChange; - public ScrollDirection direction = ScrollDirection.Horizontal; + public ScrollDirection direction = ScrollDirection.Horizontal; - protected ScrollRect scrollRect; + protected ScrollRect scrollRect; - protected RectTransform scrollRectTransform; + protected RectTransform scrollRectTransform; - protected Transform listContainerTransform; + protected Transform listContainerTransform; - protected RectTransform rectTransform; + protected RectTransform rectTransform; - int pages; + int pages; - protected int startingPage = 0; + protected int startingPage = 0; - // anchor points to lerp to to see child on certain indexes - protected Vector3[] pageAnchorPositions; + // anchor points to lerp to to see child on certain indexes + protected Vector3[] pageAnchorPositions; - protected Vector3 lerpTarget; + protected Vector3 lerpTarget; - protected bool lerp; + protected bool lerp; - // item list related - protected float listContainerMinPosition; + // item list related + protected float listContainerMinPosition; - protected float listContainerMaxPosition; + protected float listContainerMaxPosition; - protected float listContainerSize; + protected float listContainerSize; - protected RectTransform listContainerRectTransform; + protected RectTransform listContainerRectTransform; - protected Vector2 listContainerCachedSize; + protected Vector2 listContainerCachedSize; - protected float itemSize; - - protected int itemsCount = 0; + protected float itemSize; - [Tooltip("Button to go to the next page. (optional)")] - public Button nextButton; - - [Tooltip("Button to go to the previous page. (optional)")] - public Button prevButton; - - [Tooltip("Number of items visible in one page of scroll frame.")] - [RangeAttribute(1,100)] - public int itemsVisibleAtOnce = 1; - - [Tooltip("Sets minimum width of list items to 1/itemsVisibleAtOnce.")] - public bool autoLayoutItems = true; - - [Tooltip("If you wish to update scrollbar numberOfSteps to number of active children on list.")] - public bool linkScrolbarSteps = false; - - [Tooltip("If you wish to update scrollrect sensitivity to size of list element.")] - public bool linkScrolrectScrollSensitivity = false; - - public Boolean useFastSwipe = true; - - public int fastSwipeThreshold = 100; - - // drag related - protected bool startDrag = true; - - protected Vector3 positionOnDragStart = new Vector3(); - - protected int pageOnDragStart; - - protected bool fastSwipeTimer = false; - - protected int fastSwipeCounter = 0; - - protected int fastSwipeTarget = 10; - - // Use this for initialization - void Awake() - { - lerp = false; - - scrollRect = gameObject.GetComponent(); - scrollRectTransform = gameObject.GetComponent(); - listContainerTransform = scrollRect.content; - listContainerRectTransform = listContainerTransform.GetComponent(); - - rectTransform = listContainerTransform.gameObject.GetComponent(); - UpdateListItemsSize(); - UpdateListItemPositions(); - - PageChanged(CurrentPage()); - - if (nextButton) - { - nextButton.GetComponent