diff --git a/README.md b/README.md index 2c4b84b..a5504bc 100644 --- a/README.md +++ b/README.md @@ -1,264 +1,264 @@ -# Unity UI Extensions README - -This is an extension project for the new Unity UI system which can be found at: [Unity UI Source](https://github.com/Unity-Technologies/uGUI) - -> [Check out the control demos on our Tumblr page](https://unityuiextensions.tumblr.com/) - -[![openupm](https://img.shields.io/npm/v/com.unity.uiextensions?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.unity.uiextensions/) -[![Publish main branch and increment version](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/main-publish.yml/badge.svg)](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/main-publish.yml) -[![Publish development branch on Merge](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-publish.yml/badge.svg)](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-publish.yml) -[![Build and test UPM packages for platforms, all branches except main](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-buildandtestupmrelease.yml/badge.svg)](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-buildandtestupmrelease.yml) - -## [Intro](https://unity-ui-extensions.github.io/GettingStarted) - -For more info, here's a little introduction video for the project: - -[![View Intro Video](http://img.youtube.com/vi/njoIeE4akq0/0.jpg)](http://www.youtube.com/watch?v=njoIeE4akq0 "Unity UI Extensions intro video") - -You can follow the UI Extensions team for updates and news on: - -### [Twitter - #unityuiextensions](https://twitter.com/search?q=%23unityuiextensions) / [Facebook](https://www.facebook.com/UnityUIExtensions/) / [YouTube](https://www.youtube.com/@UnityUIExtensions) - -> Ways to get in touch: -> -> - [Gitter Chat](https://gitter.im/Unity-UI-Extensions/Lobby) site for the UI Extensions project -> - [GitHub Discussions](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/discussions), if you have any questions, queries or suggestions - ------ - -## [What is this repository for?](https://unity-ui-extensions.github.io/About) - -In this repository is a collection of extension scripts / effects and controls to enhance your Unity UI experience. These scripts have been gathered from many sources, combined and improved over time. - -> The majority of the scripts came from the Scripts thread on the [Unity UI forum here](http://bit.ly/UnityUIScriptsForumPost) - -You can either download / fork this project to access the scripts, or you can also download these pre-compiled Unity Assets, chock full of goodness for each release: - -## [Download Latest - Version 2.3](https://unity-ui-extensions.github.io/Downloads) - -We have expanded where you can download the UnityPackage asset and widened the options to contribute to the project. - -> I will still stress however, ***contribution is optional***. **The assets / code will always remain FREE** - -| [![Download from Itch.IO](https://unity-ui-extensions.github.io/SiteImages/itchio.png)](https://unityuiextensions.itch.io/uiextensions2-0 "Download from Itch.IO") | [![Download from Itch.IO](https://unity-ui-extensions.github.io/SiteImages/unionassets.png)](https://unionassets.com/unity-ui-extensions "Download from Union Assets") | [![Download from Itch.IO](https://unity-ui-extensions.github.io/SiteImages/patreon.jpg)](https://www.patreon.com/UnityUIExtensions "Support Unity UI Extensions on Patreon & download")| -| :--- | :--- | :--- | -| [Grab from Itchio](https://unityuiextensions.itch.io/uiextensions2-0) | [Obtain via Union Assets](https://unionassets.com/unity-ui-extensions) |[Support through Patreon](https://www.patreon.com/UnityUIExtensions) | - -> Still available to download on the [GitHub site](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/releases) if you prefer - -To view previous releases, visit the [release archive](https://unity-ui-extensions.github.io/Downloads) - ------ - -## [Supporting the UI Extensions project](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=89L8T9N6BR7LJ) - -If you wish to further support the Unity UI Extensions project itself, then you can either subsidize your downloads above, or using the links below. - -All funds go to support the project, no matter the amount. **Donations in code are also extremely welcome** - -|[![Donate via PayPal](https://www.paypalobjects.com/webstatic/mktg/Logo/pp-logo-150px.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=89L8T9N6BR7LJ "Donating via Paypal")|[![Buy us a Coffee](https://uploads-ssl.webflow.com/5c14e387dab576fe667689cf/5cbed8a4ae2b88347c06c923_BuyMeACoffee_blue-p-500.png)](https://ko-fi.com/uiextensions "Buy us a Coffee")| -|-|-| -||| - -> (PayPal account not required and you can remain anonymous if you wish) - ------ - -## [Getting Started](https://unity-ui-extensions.github.io/GettingStarted) - -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:](https://unity-ui-extensions.github.io/ReleaseNotes/RELEASENOTES) - -## Release 3.0.0 - Unity 6, reimagined - 2026/06/19 - -The V3 relaunch brings **full Unity 6 support**, a refreshed brand, and the start of a two-package ecosystem — the proven uGUI library you know, now joined by a modern UI Toolkit companion. - -> **Two packages. One ecosystem.** These notes cover the **uGUI** package (`com.unity.uiextensions`). Meet its new companion: [UI Toolkit Extensions](https://github.com/Unity-UI-Extensions/com.unity.uitoolkitextensions). - -To get up to speed with the Unity UI Extensions, check out the [Getting Started](https://unity-ui-extensions.github.io/GettingStarted.html) Page. - -> Ways to get in touch: -> -> - [GitHub Discussions](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/discussions), if you have any questions, queries or suggestions -> - [Gitter Chat](https://gitter.im/Unity-UI-Extensions/Lobby) site for the UI Extensions project -> -> Much easier that posting a question / issue on YouTube, Twitter or Facebook :D - -### Added - -- Full support for Unity 6, updating all controls and editor components for the new Unity UI framework, including compile flag support for the updated Unity 6 API (#493, #497) -- Added new GridRawImage control, applying a texture as a repeating grid on a RawImage -- Added new UI_Knob2 control, an updated take on the rotary UI Knob -- Added new UISegmentedCircle control, for drawing segmented circular UI -- Added new UI Graphic Selector control -- Added SetXWithoutNotify and SetYWithoutNotify methods to the BoxSlider, to set values without firing OnValueChanged (@Kurante2801) -- The Pivot can now be used as the reference point when drawing lines with the UILineRenderer (#490) -- Added a "close line" option to the UILineRenderer which finishes the line off with a closer to fill any gaps at the end - Resolves: #449 -- Added a new "CullingMode" option to the UI Particle System that when enabled alters the control to resolve unscaled delta time issues - Fixes #486, #487 - -### Changed - -- fix: Optimized Gradient2 when ModifyMesh is called, and it now responds to gradient key updates in both the inspector and at runtime (@bluefallsky) -- fix: Corrected the radial triangle add order (#384) (@bluefallsky) -- fix: The UILineConnector now refreshes when the global scale changes and its point array calculation has been corrected (#495) (@hugoymh) -- fix: The ReorderableList now keeps an item's rotation configuration while dragging (@JavierMonton) -- fix: Addressed a null reference exception in the ReorderableList -- fix: Resolved a stacking issue with the ReorderableList when moving elements "slightly" - Resolves: #470 -- fix: Force ScrollRect.content setup on initialization (#485) -- fix: Resolved a race condition in the ScrollSnap controls which could raise a NaN error when lerping - Resolves: #452 / #508 -- fix: Patched the HSS/VSS against a potential divide by zero error if the scroll snap has a single page -- fix: Updated GetCurrentPage on the ScrollSnaps to be more resilient - Fixes #254 -- fix: Updated the ScrollSnaps to be more resilient to rescaling and patched the full screen scroll snap RIF - Fixes #257, #260 -- fix: Resolved out of bounds issues with the Infinite scroll control - Fixes #237 -- fix: Addressed layout issues with the FlowLayoutGroup - Fixes #456 -- Layout groups updated to rebuild on disable/enable - Resolves: #468 -- Updated the UIVertical Scroller to be more efficient for Unity 6 and updated its example -- Updated the Picker control and samples to the latest version -- Removed cap points from the line renderers as they caused LOD and jagged-texture issues -- Renamed Segment to SegmentedControlSegment to avoid class name conflicts -- Updated components to maintain both Text and TextMeshPro compatibility where possible, including a debug option to allow both (#477) -- Reverted Curly Text back to the old Text component as it is not compatible with TextMeshPro - alternatives are being investigated - -### Deprecated - -- With the move to Unity 6, the old legacy Text based controls have been cleared out as they are no longer valid, along with a general script clean-up to remove legacy dependencies. For any affected component, use the TextMeshPro alternatives. - -## Additional Notes - -### [Installation Instructions](https://unity-ui-extensions.github.io/UPMInstallation.html) - -The recommended way to add the Unity UI Extensions project to your solution is to use the Unity package Manager. Simply use the Unity Package Manager to reference the project to install it - -New for 2020, we have added OpenUPM support and the package can be installed using the following [OpenUPM CLI](https://openupm.com/docs/) command: - -```cli -`openupm add com.unity.uiextensions` -``` - -> For more details on using [OpenUPM CLI, check the docs here](https://github.com/openupm/openupm-cli#installation). - -- [UI Extensions Issue log](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues) - -## Upgrade Notes - -We recommend using the UPM delivery method. If you are using the Unity asset, there should be no issues updating but if you have a problem, just deleted the old Unity-UI-Extensions folder and import the asset new. - ------ - -## Release History - -For the full release history, follow the below link to the full release notes page. - -### [Release Notes](https://unity-ui-extensions.github.io/ReleaseNotes/RELEASENOTES) - ------ - -## [Controls and extensions listed in this project](https://unity-ui-extensions.github.io/Controls) - -There are almost 70+ extension controls / effect and other utilities in the project which are listed on the following page: - -> ## [Check out the control demos on our Tumblr page](https://www.tumblr.com/blog/unityuiextensions) -> -> | [![UI Line Renderer](https://unity-ui-extensions.github.io/SiteImages/LineRenderer.gif)](https://www.tumblr.com/blog/unityuiextensions "UI Line Renderer") | [![UI Knob](https://unity-ui-extensions.github.io/SiteImages/UIKnob.gif)](https://www.tumblr.com/blog/unityuiextensions "UI Knob") | [![ScrollSnap](https://unity-ui-extensions.github.io/SiteImages/ScrollSnap.gif)](https://www.tumblr.com/blog/unityuiextensions "Scroll Snap")| -> | :--- | :--- | :--- | -> | [UI Line Renderer](https://www.tumblr.com/blog/unityuiextensions) | [UI Knob](https://www.tumblr.com/blog/unityuiextensions) |[Scroll Snap](https://www.tumblr.com/blog/unityuiextensions) | - -## [UI Extensions controls list](https://unity-ui-extensions.github.io/Controls) - -[Controls](https://unity-ui-extensions.github.io/Controls.html#controls) - -|Accordion|ColorPicker|Selection Box|Segmented Control|ComboBox| -|-|-|-|-|-| -|AutoComplete ComboBox|DropDown List|BoundToolTip|UIWindowBase|UI Knob| -|UI Knob2|TextPic|Input Focus|Box Slider|Cooldown Button| -|Stepper|Range Slider|Radial Slider|MultiTouch Scroll Rect|MinMax Slider| -|GridRawImage|UICircleSegmented|UIGraphicSector||| - -[Primitives](https://unity-ui-extensions.github.io/Controls.html#primitives) - -|UILineRenderer|UILineTextureRenderer|UILineRendererFIFO|UILineRendererList|UICircle| -|-|-|-|-|-| -|DiamondGraph|UICornerCut|UIPolygon|UISquircle|UIGridRenderer| - -[Layouts](https://unity-ui-extensions.github.io/Controls.html#layouts) - -|Horizontal Scroll Snap|Vertical Scroll Snap|Flow Layout Group|Radial Layout|Tile Size Fitter| -|-|-|-|-|-| -|Scroll Snap (alt implementation)|Reorderable List|UI Vertical Scroller|UI Horizontal Scroller|Curved Layout| -|Table Layout|FancyScrollView|Card UI|Scroll Position Controller (obsolete)|Content Scroll Snap Horizontal| -|Scroller|ResizePanel|RescalePanel|RescaleDragPanel|| - -[Effects](https://unity-ui-extensions.github.io/Controls.html#effect-components) - -|Gradient|Gradient2|RaycastMask|SoftAlphaMask|UIFlippable| -|-|-|-|-|-| -|UIImageCrop|UIParticleSystem|CurlyUI|Shine Effect|Shader Effects| - -> The legacy Text based effects (Best Fit Outline, Curved Text, Letter Spacing, NicerOutline and CylinderText) were removed in V3.0.0 as they are not supported with TextMeshPro due to its architecture, try using the native TextMeshPro effects instead. - -[Additional Components](https://unity-ui-extensions.github.io/Controls.html#additional-components) - -|ReturnKeyTrigger|TabNavigation|uGUITools|ScrollRectTweener|ScrollRectLinker| -|-|-|-|-|-| -|ScrollRectEx|UI_InfiniteScroll|UI_ScrollRectOcclusion|UIScrollToSelection|UISelectableExtension| -|switchToRectTransform|ScrollConflictManager|CLFZ2 (Compression)|DragCorrector|PPIViewer| -|UI_TweenScale|UI_MagneticInfiniteScroll|NonDrawingGraphic|UILineConnector|UIHighlightable| -|Menu Manager|Pagination Manager|ResetSelectableHighlight|SelectableScaler|InputFieldEnterSubmit| - -*More to come* - ------ - -## [How do I get set up?](https://unity-ui-extensions.github.io/UPMInstallation.html) - -The recommended way to add the Unity UI Extensions project to your solution is to use the Unity package Manager. Simply use the Unity Package Manager to reference the project to install it - -New for 2020, we have added OpenUPM support and the package can be installed using the following [OpenUPM CLI](https://openupm.com/docs/) command: - -```cli -`openupm add com.unity.uiextensions` -``` - -> For more details on using [OpenUPM CLI, check the docs here](https://github.com/openupm/openupm-cli#installation). - -- Unity Package Manager - manual - -Alternatively, you can also add the package manually through the Unity package manager using the scope ```com.unity.uiextensions```, see the [Unity Package Manager docs](https://learn.unity.com/tutorial/the-package-manager) for more information. - -- Unity 2018 or lower -The pre-compiled Unity assets are the only solution for Unity 2018 or earlier due to the changes in the Unity UI framework in Unity made for 2019. -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](https://unity-ui-extensions.github.io/ContributionGuidelines) - -Got a script you want added? Then just fork the [GitHub repository](https://github.com/unity-UI-Extensions/com.unity.uiextensions) and submit a PR. All contributions accepted (including fixes) - -Just ensure: - -- The header of the script should match the standard used in all scripts. -- The script uses the **Unity.UI.Extensions** namespace so they do not affect any other developments. -- (optional) Add Component and Editor options where possible. (editor options are in the Editor\UIExtensionsMenuOptions.cs file) - -## [License](https://raw.githubusercontent.com/Unity-UI-Extensions/com.unity.uiextensions/release/LICENSE.md) - -All scripts conform to the BSD-3-Clause license and are free to use / distribute. See the [LICENSE](https://raw.githubusercontent.com/Unity-UI-Extensions/com.unity.uiextensions/release/LICENSE.md) file for more information = - -## [Like what you see?](https://unity-ui-extensions.github.io/FurtherInfo) - -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. - -## [The downloads](https://unity-ui-extensions.github.io/Downloads) - -As this repo was created to support my new Unity UI Title ["Unity 3D UI Essentials"](http://bit.ly/Unity3DUIEssentials), in the downloads section you will find two custom assets (SpaceShip-DemoScene-Start.unitypackage and RollABallSample-Start.unitypackage). These are just here as starter scenes for doing UI tasks in the book. - -I will add more sample scenes for the UI examples in this repository and detail them above over time. - -## [Previous Releases](https://unity-ui-extensions.github.io/Downloads) - -Please see the [full downloads list](https://unity-ui-extensions.github.io/Downloads) for all previous releases and their corresponding download links. +# Unity UI Extensions README + +This is an extension project for the new Unity UI system which can be found at: [Unity UI Source](https://github.com/Unity-Technologies/uGUI) + +> [Check out the control demos on our Tumblr page](https://unityuiextensions.tumblr.com/) + +[![openupm](https://img.shields.io/npm/v/com.unity.uiextensions?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.unity.uiextensions/) +[![Publish main branch and increment version](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/main-publish.yml/badge.svg)](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/main-publish.yml) +[![Publish development branch on Merge](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-publish.yml/badge.svg)](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-publish.yml) +[![Build and test UPM packages for platforms, all branches except main](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-buildandtestupmrelease.yml/badge.svg)](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/actions/workflows/development-buildandtestupmrelease.yml) + +## [Intro](https://unity-ui-extensions.github.io/GettingStarted) + +For more info, here's a little introduction video for the project: + +[![View Intro Video](http://img.youtube.com/vi/njoIeE4akq0/0.jpg)](http://www.youtube.com/watch?v=njoIeE4akq0 "Unity UI Extensions intro video") + +You can follow the UI Extensions team for updates and news on: + +### [Twitter - #unityuiextensions](https://twitter.com/search?q=%23unityuiextensions) / [Facebook](https://www.facebook.com/UnityUIExtensions/) / [YouTube](https://www.youtube.com/@UnityUIExtensions) + +> Ways to get in touch: +> +> - [Gitter Chat](https://gitter.im/Unity-UI-Extensions/Lobby) site for the UI Extensions project +> - [GitHub Discussions](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/discussions), if you have any questions, queries or suggestions + +----- + +## [What is this repository for?](https://unity-ui-extensions.github.io/About) + +In this repository is a collection of extension scripts / effects and controls to enhance your Unity UI experience. These scripts have been gathered from many sources, combined and improved over time. + +> The majority of the scripts came from the Scripts thread on the [Unity UI forum here](http://bit.ly/UnityUIScriptsForumPost) + +You can either download / fork this project to access the scripts, or you can also download these pre-compiled Unity Assets, chock full of goodness for each release: + +## [Download Latest - Version 2.3](https://unity-ui-extensions.github.io/Downloads) + +We have expanded where you can download the UnityPackage asset and widened the options to contribute to the project. + +> I will still stress however, ***contribution is optional***. **The assets / code will always remain FREE** + +| [![Download from Itch.IO](https://unity-ui-extensions.github.io/SiteImages/itchio.png)](https://unityuiextensions.itch.io/uiextensions2-0 "Download from Itch.IO") | [![Download from Itch.IO](https://unity-ui-extensions.github.io/SiteImages/unionassets.png)](https://unionassets.com/unity-ui-extensions "Download from Union Assets") | [![Download from Itch.IO](https://unity-ui-extensions.github.io/SiteImages/patreon.jpg)](https://www.patreon.com/UnityUIExtensions "Support Unity UI Extensions on Patreon & download")| +| :--- | :--- | :--- | +| [Grab from Itchio](https://unityuiextensions.itch.io/uiextensions2-0) | [Obtain via Union Assets](https://unionassets.com/unity-ui-extensions) |[Support through Patreon](https://www.patreon.com/UnityUIExtensions) | + +> Still available to download on the [GitHub site](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/releases) if you prefer + +To view previous releases, visit the [release archive](https://unity-ui-extensions.github.io/Downloads) + +----- + +## [Supporting the UI Extensions project](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=89L8T9N6BR7LJ) + +If you wish to further support the Unity UI Extensions project itself, then you can either subsidize your downloads above, or using the links below. + +All funds go to support the project, no matter the amount. **Donations in code are also extremely welcome** + +|[![Donate via PayPal](https://www.paypalobjects.com/webstatic/mktg/Logo/pp-logo-150px.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=89L8T9N6BR7LJ "Donating via Paypal")|[![Buy us a Coffee](https://uploads-ssl.webflow.com/5c14e387dab576fe667689cf/5cbed8a4ae2b88347c06c923_BuyMeACoffee_blue-p-500.png)](https://ko-fi.com/uiextensions "Buy us a Coffee")| +|-|-| +||| + +> (PayPal account not required and you can remain anonymous if you wish) + +----- + +## [Getting Started](https://unity-ui-extensions.github.io/GettingStarted) + +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:](https://unity-ui-extensions.github.io/ReleaseNotes/RELEASENOTES) + +## Release 3.0.0 - Unity 6, reimagined - 2026/06/19 + +The V3 relaunch brings **full Unity 6 support**, a refreshed brand, and the start of a two-package ecosystem — the proven uGUI library you know, now joined by a modern UI Toolkit companion. + +> **Two packages. One ecosystem.** These notes cover the **uGUI** package (`com.unity.uiextensions`). Meet its new companion: [UI Toolkit Extensions](https://github.com/Unity-UI-Extensions/com.unity.uitoolkitextensions). + +To get up to speed with the Unity UI Extensions, check out the [Getting Started](https://unity-ui-extensions.github.io/GettingStarted.html) Page. + +> Ways to get in touch: +> +> - [GitHub Discussions](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/discussions), if you have any questions, queries or suggestions +> - [Gitter Chat](https://gitter.im/Unity-UI-Extensions/Lobby) site for the UI Extensions project +> +> Much easier that posting a question / issue on YouTube, Twitter or Facebook :D + +### Added + +- Full support for Unity 6, updating all controls and editor components for the new Unity UI framework, including compile flag support for the updated Unity 6 API (#493, #497) +- Added new GridRawImage control, applying a texture as a repeating grid on a RawImage +- Added new UI_Knob2 control, an updated take on the rotary UI Knob +- Added new UISegmentedCircle control, for drawing segmented circular UI +- Added new UI Graphic Selector control +- Added SetXWithoutNotify and SetYWithoutNotify methods to the BoxSlider, to set values without firing OnValueChanged (@Kurante2801) +- The Pivot can now be used as the reference point when drawing lines with the UILineRenderer (#490) +- Added a "close line" option to the UILineRenderer which finishes the line off with a closer to fill any gaps at the end - Resolves: #449 +- Added a new "CullingMode" option to the UI Particle System that when enabled alters the control to resolve unscaled delta time issues - Fixes #486, #487 + +### Changed + +- fix: Optimized Gradient2 when ModifyMesh is called, and it now responds to gradient key updates in both the inspector and at runtime (@bluefallsky) +- fix: Corrected the radial triangle add order (#384) (@bluefallsky) +- fix: The UILineConnector now refreshes when the global scale changes and its point array calculation has been corrected (#495) (@hugoymh) +- fix: The ReorderableList now keeps an item's rotation configuration while dragging (@JavierMonton) +- fix: Addressed a null reference exception in the ReorderableList +- fix: Resolved a stacking issue with the ReorderableList when moving elements "slightly" - Resolves: #470 +- fix: Force ScrollRect.content setup on initialization (#485) +- fix: Resolved a race condition in the ScrollSnap controls which could raise a NaN error when lerping - Resolves: #452 / #508 +- fix: Patched the HSS/VSS against a potential divide by zero error if the scroll snap has a single page +- fix: Updated GetCurrentPage on the ScrollSnaps to be more resilient - Fixes #254 +- fix: Updated the ScrollSnaps to be more resilient to rescaling and patched the full screen scroll snap RIF - Fixes #257, #260 +- fix: Resolved out of bounds issues with the Infinite scroll control - Fixes #237 +- fix: Addressed layout issues with the FlowLayoutGroup - Fixes #456 +- Layout groups updated to rebuild on disable/enable - Resolves: #468 +- Updated the UIVertical Scroller to be more efficient for Unity 6 and updated its example +- Updated the Picker control and samples to the latest version +- Removed cap points from the line renderers as they caused LOD and jagged-texture issues +- Renamed Segment to SegmentedControlSegment to avoid class name conflicts +- Updated components to maintain both Text and TextMeshPro compatibility where possible, including a debug option to allow both (#477) +- Reverted Curly Text back to the old Text component as it is not compatible with TextMeshPro - alternatives are being investigated + +### Deprecated + +- With the move to Unity 6, the old legacy Text based controls have been cleared out as they are no longer valid, along with a general script clean-up to remove legacy dependencies. For any affected component, use the TextMeshPro alternatives. + +## Additional Notes + +### [Installation Instructions](https://unity-ui-extensions.github.io/UPMInstallation.html) + +The recommended way to add the Unity UI Extensions project to your solution is to use the Unity package Manager. Simply use the Unity Package Manager to reference the project to install it + +New for 2020, we have added OpenUPM support and the package can be installed using the following [OpenUPM CLI](https://openupm.com/docs/) command: + +```cli +`openupm add com.unity.uiextensions` +``` + +> For more details on using [OpenUPM CLI, check the docs here](https://github.com/openupm/openupm-cli#installation). + +- [UI Extensions Issue log](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues) + +## Upgrade Notes + +We recommend using the UPM delivery method. If you are using the Unity asset, there should be no issues updating but if you have a problem, just deleted the old Unity-UI-Extensions folder and import the asset new. + +----- + +## Release History + +For the full release history, follow the below link to the full release notes page. + +### [Release Notes](https://unity-ui-extensions.github.io/ReleaseNotes/RELEASENOTES) + +----- + +## [Controls and extensions listed in this project](https://unity-ui-extensions.github.io/Controls) + +There are almost 70+ extension controls / effect and other utilities in the project which are listed on the following page: + +> ## [Check out the control demos on our Tumblr page](https://www.tumblr.com/blog/unityuiextensions) +> +> | [![UI Line Renderer](https://unity-ui-extensions.github.io/SiteImages/LineRenderer.gif)](https://www.tumblr.com/blog/unityuiextensions "UI Line Renderer") | [![UI Knob](https://unity-ui-extensions.github.io/SiteImages/UIKnob.gif)](https://www.tumblr.com/blog/unityuiextensions "UI Knob") | [![ScrollSnap](https://unity-ui-extensions.github.io/SiteImages/ScrollSnap.gif)](https://www.tumblr.com/blog/unityuiextensions "Scroll Snap")| +> | :--- | :--- | :--- | +> | [UI Line Renderer](https://www.tumblr.com/blog/unityuiextensions) | [UI Knob](https://www.tumblr.com/blog/unityuiextensions) |[Scroll Snap](https://www.tumblr.com/blog/unityuiextensions) | + +## [UI Extensions controls list](https://unity-ui-extensions.github.io/Controls) + +[Controls](https://unity-ui-extensions.github.io/Controls.html#controls) + +|Accordion|ColorPicker|Selection Box|Segmented Control|ComboBox| +|-|-|-|-|-| +|AutoComplete ComboBox|DropDown List|BoundToolTip|UIWindowBase|UI Knob| +|UI Knob2|TextPic|Input Focus|Box Slider|Cooldown Button| +|Stepper|Range Slider|Radial Slider|MultiTouch Scroll Rect|MinMax Slider| +|GridRawImage|UICircleSegmented|UIGraphicSector||| + +[Primitives](https://unity-ui-extensions.github.io/Controls.html#primitives) + +|UILineRenderer|UILineTextureRenderer|UILineRendererFIFO|UILineRendererList|UICircle| +|-|-|-|-|-| +|DiamondGraph|UICornerCut|UIPolygon|UISquircle|UIGridRenderer| + +[Layouts](https://unity-ui-extensions.github.io/Controls.html#layouts) + +|Horizontal Scroll Snap|Vertical Scroll Snap|Flow Layout Group|Radial Layout|Tile Size Fitter| +|-|-|-|-|-| +|Scroll Snap (alt implementation)|Reorderable List|UI Vertical Scroller|UI Horizontal Scroller|Curved Layout| +|Table Layout|FancyScrollView|Card UI|Scroll Position Controller (obsolete)|Content Scroll Snap Horizontal| +|Scroller|ResizePanel|RescalePanel|RescaleDragPanel|| + +[Effects](https://unity-ui-extensions.github.io/Controls.html#effect-components) + +|Gradient|Gradient2|RaycastMask|SoftAlphaMask|UIFlippable| +|-|-|-|-|-| +|UIImageCrop|UIParticleSystem|CurlyUI|Shine Effect|Shader Effects| + +> The legacy Text based effects (Best Fit Outline, Curved Text, Letter Spacing, NicerOutline and CylinderText) were removed in V3.0.0 as they are not supported with TextMeshPro due to its architecture, try using the native TextMeshPro effects instead. + +[Additional Components](https://unity-ui-extensions.github.io/Controls.html#additional-components) + +|ReturnKeyTrigger|TabNavigation|uGUITools|ScrollRectTweener|ScrollRectLinker| +|-|-|-|-|-| +|ScrollRectEx|UI_InfiniteScroll|UI_ScrollRectOcclusion|UIScrollToSelection|UISelectableExtension| +|switchToRectTransform|ScrollConflictManager|CLFZ2 (Compression)|DragCorrector|PPIViewer| +|UI_TweenScale|UI_MagneticInfiniteScroll|NonDrawingGraphic|UILineConnector|UIHighlightable| +|Menu Manager|Pagination Manager|ResetSelectableHighlight|SelectableScaler|InputFieldEnterSubmit| + +*More to come* + +----- + +## [How do I get set up?](https://unity-ui-extensions.github.io/UPMInstallation.html) + +The recommended way to add the Unity UI Extensions project to your solution is to use the Unity package Manager. Simply use the Unity Package Manager to reference the project to install it + +New for 2020, we have added OpenUPM support and the package can be installed using the following [OpenUPM CLI](https://openupm.com/docs/) command: + +```cli +`openupm add com.unity.uiextensions` +``` + +> For more details on using [OpenUPM CLI, check the docs here](https://github.com/openupm/openupm-cli#installation). + +- Unity Package Manager - manual + +Alternatively, you can also add the package manually through the Unity package manager using the scope ```com.unity.uiextensions```, see the [Unity Package Manager docs](https://learn.unity.com/tutorial/the-package-manager) for more information. + +- Unity 2018 or lower +The pre-compiled Unity assets are the only solution for Unity 2018 or earlier due to the changes in the Unity UI framework in Unity made for 2019. +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](https://unity-ui-extensions.github.io/ContributionGuidelines) + +Got a script you want added? Then just fork the [GitHub repository](https://github.com/unity-UI-Extensions/com.unity.uiextensions) and submit a PR. All contributions accepted (including fixes) + +Just ensure: + +- The header of the script should match the standard used in all scripts. +- The script uses the **Unity.UI.Extensions** namespace so they do not affect any other developments. +- (optional) Add Component and Editor options where possible. (editor options are in the Editor\UIExtensionsMenuOptions.cs file) + +## [License](https://raw.githubusercontent.com/Unity-UI-Extensions/com.unity.uiextensions/release/LICENSE.md) + +All scripts conform to the BSD-3-Clause license and are free to use / distribute. See the [LICENSE](https://raw.githubusercontent.com/Unity-UI-Extensions/com.unity.uiextensions/release/LICENSE.md) file for more information = + +## [Like what you see?](https://unity-ui-extensions.github.io/FurtherInfo) + +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. + +## [The downloads](https://unity-ui-extensions.github.io/Downloads) + +As this repo was created to support my new Unity UI Title ["Unity 3D UI Essentials"](http://bit.ly/Unity3DUIEssentials), in the downloads section you will find two custom assets (SpaceShip-DemoScene-Start.unitypackage and RollABallSample-Start.unitypackage). These are just here as starter scenes for doing UI tasks in the book. + +I will add more sample scenes for the UI examples in this repository and detail them above over time. + +## [Previous Releases](https://unity-ui-extensions.github.io/Downloads) + +Please see the [full downloads list](https://unity-ui-extensions.github.io/Downloads) for all previous releases and their corresponding download links. diff --git a/Runtime/Scripts/Layout/SmartFlowLayoutGroup.cs b/Runtime/Scripts/Layout/SmartFlowLayoutGroup.cs new file mode 100644 index 0000000..6deddd3 --- /dev/null +++ b/Runtime/Scripts/Layout/SmartFlowLayoutGroup.cs @@ -0,0 +1,495 @@ +/// Credit [PeterParkers007] +/// Sourced from - [https://github.com/PeterParkers007] +/// Based on FlowLayoutGroup by Simie - http://forum.unity3d.com/threads/flowlayoutgroup.296709/ +/// Enhanced with: +/// - Multiple sizing modes (AutoSize, UniformCell, UniformCellKeepAspect, StretchRow) +/// - Fixed columns per row support +/// - Reverse wrap direction +/// - Aspect ratio preservation +/// - Improved handling of nested LayoutGroups +using System.Collections.Generic; +using UnityEngine.UI; + +namespace UnityEngine.UI.Extensions +{ + /// + /// Smart Flow Layout Group - Enhanced version of FlowLayoutGroup with multiple sizing modes. + /// Supports uniform cells, aspect ratio preservation, stretch rows, and reverse wrapping. + /// + [AddComponentMenu("Layout/Extensions/Smart Flow Layout Group")] + [ExecuteAlways] + [DisallowMultipleComponent] + public class SmartFlowLayoutGroup : LayoutGroup + { + public enum Axis { Horizontal = 0, Vertical = 1 } + + public enum SizingMode + { + /// Reads child PreferredSize (original FlowLayoutGroup behavior). + AutoSize = 0, + /// Forces all children to CellSize, ignoring original proportions. + UniformCell = 1, + /// Uniform cell size; children scale to fit inside while preserving aspect ratio. + UniformCellKeepAspect = 2, + /// List rows: width fills container, height uses PreferredHeight. CellSize.y as minimum row height. + StretchRow = 3, + } + + [Tooltip("Flow start axis: Horizontal = left to right, wrap on overflow; Vertical = top to bottom, wrap on overflow")] + [SerializeField] Axis m_StartAxis = Axis.Horizontal; + + [Tooltip("AutoSize=read preferred; UniformCell=force CellSize; KeepAspect=icon grid; StretchRow=full width list")] + [SerializeField] SizingMode m_SizingMode = SizingMode.UniformCellKeepAspect; + + [Tooltip("Uniform cell size (used by UniformCell/KeepAspect; StretchRow uses y as minimum row height)")] + [SerializeField] Vector2 m_CellSize = new Vector2(100f, 100f); + + [Tooltip("≤0 = auto wrap by container width; >0 = fixed columns per row (Horizontal axis only)")] + [SerializeField] int m_ColumnsPerRow = 0; + + [Tooltip("Horizontal spacing between elements")] + [SerializeField] float m_SpacingX = 0f; + + [Tooltip("Vertical spacing between rows")] + [SerializeField] float m_SpacingY = 0f; + + [Tooltip("Stretch children height to fill the row height")] + [SerializeField] bool m_ChildForceExpandHeight = false; + + [Tooltip("AutoSize mode: stretch children width to fill container width")] + [SerializeField] bool m_ChildForceExpandWidth = false; + + [Tooltip("Reverse wrap direction: true = first row at bottom, stacking upward (Horizontal axis only)")] + [SerializeField] bool m_ReverseWrap = false; + + /// Flow start axis. + public Axis StartAxis { get => m_StartAxis; set => SetProperty(ref m_StartAxis, value); } + + /// Sizing mode determines how child elements are sized. + public SizingMode Sizing { get => m_SizingMode; set => SetProperty(ref m_SizingMode, value); } + + /// Uniform cell size for grid-based modes. + public Vector2 CellSize { get => m_CellSize; set => SetProperty(ref m_CellSize, value); } + + /// Fixed columns per row (0 = auto). + public int ColumnsPerRow + { + get => m_ColumnsPerRow; + set => SetProperty(ref m_ColumnsPerRow, Mathf.Max(0, value)); + } + + /// Spacing between elements (X = horizontal, Y = vertical). + public Vector2 Spacing + { + get => new Vector2(m_SpacingX, m_SpacingY); + set + { + m_SpacingX = value.x; + m_SpacingY = value.y; + SetDirty(); + } + } + + /// Horizontal spacing between elements. + public float SpacingX { get => m_SpacingX; set => SetProperty(ref m_SpacingX, value); } + + /// Vertical spacing between rows. + public float SpacingY { get => m_SpacingY; set => SetProperty(ref m_SpacingY, value); } + + /// Stretch children to fill row height. + public bool ChildForceExpandHeight + { + get => m_ChildForceExpandHeight; + set => SetProperty(ref m_ChildForceExpandHeight, value); + } + + /// Stretch children to fill container width in AutoSize mode. + public bool ChildForceExpandWidth + { + get => m_ChildForceExpandWidth; + set => SetProperty(ref m_ChildForceExpandWidth, value); + } + + /// Reverse wrap direction (first row at bottom). + public bool ReverseWrap + { + get => m_ReverseWrap; + set => SetProperty(ref m_ReverseWrap, value); + } + + float _layoutWidth; + float _layoutHeight; + + public override void CalculateLayoutInputHorizontal() + { + base.CalculateLayoutInputHorizontal(); + if (m_StartAxis == Axis.Horizontal) + { + float min = GetGreatestMinimumChildWidth() + padding.left + padding.right; + SetLayoutInputForAxis(min, -1, -1, 0); + } + else + { + _layoutWidth = SetLayout(0, true); + } + } + + public override void CalculateLayoutInputVertical() + { + if (m_StartAxis == Axis.Horizontal) + { + _layoutHeight = SetLayout(1, true); + } + else + { + float min = GetGreatestMinimumChildHeight() + padding.top + padding.bottom; + SetLayoutInputForAxis(min, -1, -1, 1); + } + } + + public override void SetLayoutHorizontal() => SetLayout(0, false); + public override void SetLayoutVertical() => SetLayout(1, false); + + /// Main layout calculation. Returns total size along the cross axis. + float SetLayout(int axis, bool layoutInput) + { + float groupWidth = rectTransform.rect.width; + float groupHeight = rectTransform.rect.height; + + bool horizontal = m_StartAxis == Axis.Horizontal; + float workingSize = horizontal + ? groupWidth - padding.left - padding.right + : groupHeight - padding.top - padding.bottom; + + // Handle zero-size rect on first frame + if (workingSize <= 0.01f && horizontal) + workingSize = Mathf.Max(0f, GetGreatestMinimumChildWidth()); + + var entries = new List(rectChildren.Count); + for (int i = 0; i < rectChildren.Count; i++) + entries.Add(ResolveEntry(rectChildren[i], workingSize, horizontal)); + + // Group entries into lines (rows or columns) + var lines = new List>(); + var currentLine = new List(); + float lineCursor = 0f; + + int columnsPerRow = (horizontal && m_SizingMode != SizingMode.StretchRow) + ? m_ColumnsPerRow + : 0; + + float mainSpacing = horizontal ? m_SpacingX : m_SpacingY; + + for (int i = 0; i < entries.Count; i++) + { + var e = entries[i]; + float itemSize = horizontal ? e.SlotW : e.SlotH; + + bool exceedsWidth = currentLine.Count > 0 + && lineCursor + mainSpacing + itemSize > workingSize + 0.01f; + bool exceedsColumns = columnsPerRow > 0 && currentLine.Count >= columnsPerRow; + + if (currentLine.Count > 0 && (exceedsWidth || exceedsColumns)) + { + lines.Add(currentLine); + currentLine = new List(); + lineCursor = 0f; + } + + if (currentLine.Count > 0) + lineCursor += mainSpacing; + currentLine.Add(e); + lineCursor += itemSize; + } + if (currentLine.Count > 0) + lines.Add(currentLine); + + // Fill incomplete rows when using fixed columns + if (columnsPerRow > 0) + { + for (int i = 0; i < lines.Count; i++) + { + while (lines[i].Count < columnsPerRow) + lines[i].Add(Entry.Empty); + } + } + + bool reverse = m_ReverseWrap && horizontal; + float offset; + if (reverse) + offset = groupHeight - padding.bottom; + else + offset = horizontal ? padding.top : padding.left; + + float crossSpacing = horizontal ? m_SpacingY : m_SpacingX; + float totalCross = 0f; + + for (int li = 0; li < lines.Count; li++) + { + var line = lines[li]; + float lineMain = 0f; + float lineCross = 0f; + + for (int j = 0; j < line.Count; j++) + { + var e = line[j]; + lineMain += (j > 0 ? mainSpacing : 0f) + (horizontal ? e.SlotW : e.SlotH); + if (e.IsValid) + lineCross = Mathf.Max(lineCross, horizontal ? e.SlotH : e.SlotW); + } + + if (m_ChildForceExpandHeight && horizontal + && m_SizingMode != SizingMode.UniformCellKeepAspect + && m_SizingMode != SizingMode.StretchRow) + lineCross = Mathf.Max(lineCross, m_CellSize.y); + + if (reverse) + { + offset -= lineCross; + if (!layoutInput) + PlaceLine(line, lineMain, lineCross, workingSize, offset, axis, horizontal, mainSpacing); + offset -= crossSpacing; + } + else + { + if (!layoutInput) + PlaceLine(line, lineMain, lineCross, workingSize, offset, axis, horizontal, mainSpacing); + offset += lineCross + crossSpacing; + } + totalCross += lineCross + (li > 0 ? crossSpacing : 0f); + } + totalCross += (horizontal ? padding.top + padding.bottom : padding.left + padding.right); + + if (layoutInput) + { + if (horizontal) + { + _layoutHeight = totalCross; + SetLayoutInputForAxis(totalCross, totalCross, -1, 1); + } + else + { + _layoutWidth = totalCross; + SetLayoutInputForAxis(totalCross, totalCross, -1, 0); + } + } + + return totalCross; + } + + void PlaceLine(List line, float lineMain, float lineCross, float workingSize, + float crossOffset, int axis, bool horizontal, float mainSpacing) + { + float mainStart = horizontal ? padding.left : padding.top; + float slack = workingSize - lineMain; + + if (slack > 0f) + { + if (IsCenterAlign) mainStart += slack * 0.5f; + else if (IsRightAlign) mainStart += slack; + } + + float cursor = mainStart; + for (int j = 0; j < line.Count; j++) + { + var e = line[j]; + if (j > 0) + cursor += mainSpacing; + + if (e.IsValid) + { + float slotW = e.SlotW; + float slotH = e.SlotH; + float childW = e.Width; + float childH = e.Height; + + // Handle height expansion (except KeepAspect and StretchRow modes) + if (m_ChildForceExpandHeight && horizontal + && m_SizingMode != SizingMode.UniformCellKeepAspect + && m_SizingMode != SizingMode.StretchRow) + { + slotH = lineCross; + childH = lineCross; + } + + float x = cursor + (slotW - childW) * 0.5f; + float y = crossOffset + (lineCross - childH) * 0.5f; + + // Left-align for StretchRow and ExpandWidth modes + if (m_SizingMode == SizingMode.StretchRow + || (m_ChildForceExpandWidth && horizontal && m_SizingMode == SizingMode.AutoSize)) + { + x = cursor; + y = crossOffset; + } + + if (axis == 0) + SetChildAlongAxis(e.Child, 0, x, childW); + else + SetChildAlongAxis(e.Child, 1, y, childH); + + if (horizontal) + SetChildAlongAxis(e.Child, 1, y, childH); + else + SetChildAlongAxis(e.Child, 0, x, childW); + + // Rebuild nested LayoutGroups to prevent layout corruption + if (e.Child.TryGetComponent(out var nestedLayout)) + LayoutRebuilder.ForceRebuildLayoutImmediate(e.Child); + } + cursor += (horizontal ? e.SlotW : e.SlotH); + } + } + + struct Entry + { + public RectTransform Child; + public float SlotW; + public float SlotH; + public float Width; + public float Height; + public bool IsValid => Child != null; + + public static Entry Empty => new Entry { Child = null, SlotW = 0f, SlotH = 0f, Width = 0f, Height = 0f }; + } + + /// Resolves child dimensions based on SizingMode. + Entry ResolveEntry(RectTransform child, float workingMain, bool horizontal) + { + float prefW = LayoutUtility.GetPreferredSize(child, 0); + float prefH = LayoutUtility.GetPreferredSize(child, 1); + + // Fallback when preferred sizes are not properly declared + if (prefW <= 0.01f) prefW = child.rect.width; + if (prefH <= 0.01f) prefH = child.rect.height; + if (prefW <= 0.01f) prefW = m_CellSize.x > 0.01f ? m_CellSize.x : 1f; + if (prefH <= 0.01f) prefH = m_CellSize.y > 0.01f ? m_CellSize.y : 1f; + + switch (m_SizingMode) + { + case SizingMode.UniformCell: + return new Entry + { + Child = child, + SlotW = m_CellSize.x, + SlotH = m_CellSize.y, + Width = m_CellSize.x, + Height = m_CellSize.y + }; + + case SizingMode.UniformCellKeepAspect: + { + float scale = Mathf.Min(m_CellSize.x / prefW, m_CellSize.y / prefH); + return new Entry + { + Child = child, + SlotW = m_CellSize.x, + SlotH = m_CellSize.y, + Width = prefW * scale, + Height = prefH * scale + }; + } + + case SizingMode.StretchRow: + { + float w = workingMain > 0.01f ? workingMain : prefW; + float h = ResolveRowHeight(child, prefH); + return new Entry + { + Child = child, + SlotW = w, + SlotH = h, + Width = w, + Height = h + }; + } + + case SizingMode.AutoSize: + default: + { + float w = prefW; + float h = prefH; + + if (horizontal && m_ChildForceExpandWidth && workingMain > 0.01f) + w = workingMain; + else if (horizontal && workingMain > 0.01f && w > workingMain) + w = workingMain; + + if (!horizontal && m_ChildForceExpandWidth && workingMain > 0.01f) + h = workingMain; + + return new Entry + { + Child = child, + SlotW = w, + SlotH = h, + Width = w, + Height = h + }; + } + } + } + + float ResolveRowHeight(RectTransform child, float prefH) + { + float h = prefH; + + if (child.TryGetComponent(out var le)) + { + if (le.preferredHeight > 0.01f) + h = le.preferredHeight; + else if (le.minHeight > 0.01f) + h = le.minHeight; + } + + // Clamp to reasonable height to prevent layout corruption + float cap = m_CellSize.y > 0.01f ? m_CellSize.y * 3f : 200f; + if (h > cap) + h = m_CellSize.y > 0.01f ? m_CellSize.y : 56f; + + if (m_CellSize.y > 0.01f) + h = Mathf.Max(h, m_CellSize.y); + + return h; + } + + bool IsCenterAlign => + childAlignment == TextAnchor.UpperCenter + || childAlignment == TextAnchor.MiddleCenter + || childAlignment == TextAnchor.LowerCenter; + + bool IsRightAlign => + childAlignment == TextAnchor.UpperRight + || childAlignment == TextAnchor.MiddleRight + || childAlignment == TextAnchor.LowerRight; + + float GetGreatestMinimumChildWidth() + { + float max = 0f; + for (int i = 0; i < rectChildren.Count; i++) + max = Mathf.Max(max, LayoutUtility.GetMinWidth(rectChildren[i])); + return max; + } + + float GetGreatestMinimumChildHeight() + { + float max = 0f; + for (int i = 0; i < rectChildren.Count; i++) + max = Mathf.Max(max, LayoutUtility.GetMinHeight(rectChildren[i])); + return max; + } + + protected override void OnEnable() + { + base.OnEnable(); + LayoutRebuilder.ForceRebuildLayoutImmediate(rectTransform); + } + + protected override void OnDisable() + { + m_Tracker.Clear(); + LayoutRebuilder.MarkLayoutForRebuild(rectTransform); + base.OnDisable(); + } + } +} diff --git a/Runtime/Scripts/Layout/SmartFlowLayoutGroup.cs.meta b/Runtime/Scripts/Layout/SmartFlowLayoutGroup.cs.meta new file mode 100644 index 0000000..e122d0e --- /dev/null +++ b/Runtime/Scripts/Layout/SmartFlowLayoutGroup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f1a2b3c4d5e6478901a2b3c4d5e6f708 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: