Compare commits

...

170 Commits

Author SHA1 Message Date
Simon (Darkside) Jackson 35b9985bf2
Merge pull request #472 from Kurante2801/release
Add SetXWithoutNotify and SetYWithoutNotify to BoxSlider
2024-04-21 23:38:01 +01:00
Kurante 05682c7dd9
Add SetXWithoutNotify and SetYWithoutNotify to BoxSlider
Adds functions to set the X and Y values without calling OnValueChanged
2024-04-19 18:07:33 +02:00
action 855607ab67 Auto increment pre-release version to 2.3.2 [skip ci] 2023-11-26 18:28:50 +00:00
Simon (Darkside) Jackson 17835a66e8
Merge pull request #464 from Unity-UI-Extensions/development
Release 2.3.2 - take 4
2023-11-26 18:28:33 +00:00
Simon (Darkside) Jackson 6f09750bf0
Merge branch 'release' into development 2023-11-26 18:28:24 +00:00
Simon (Darkside) Jackson 1ed83c429d
Alin correct ancillary workflow 2023-11-26 18:27:15 +00:00
Simon (Darkside) Jackson 14279705a7
Merge pull request #463 from Unity-UI-Extensions/development
Release 2.3.2 - take 3
2023-11-26 18:25:24 +00:00
Simon (Darkside) Jackson 8694f1a134
Merge branch 'release' into development 2023-11-26 18:25:17 +00:00
Simon (Darkside) Jackson 98ab33952a
Fix proper branch name for UI Extensions in release workflow 2023-11-26 18:24:30 +00:00
Simon (Darkside) Jackson 5ec4b0ba93
Merge pull request #462 from Unity-UI-Extensions/development
Release 2.3.2 - take 2
2023-11-26 18:20:01 +00:00
Simon (Darkside) Jackson d69ee0c2c9
Merge branch 'release' into development 2023-11-26 18:19:26 +00:00
Simon (Darkside) Jackson a11eff0f51
Add missing workflow 2023-11-26 18:17:47 +00:00
Simon (Darkside) Jackson e909d73a6a
Merge pull request #461 from Unity-UI-Extensions/development
Release 2.3.2
2023-11-26 18:14:19 +00:00
SimonDarksideJ 2db16bbdb2 Update uGUI tools path as per Asset Store validation 2023-11-26 17:46:56 +00:00
SimonDarksideJ bce6e8b815 Update documentation for release 2023-11-26 17:31:49 +00:00
action 18a2269d63 Auto increment pre-release version to 2.3.2-pre.5 [skip ci] 2023-11-26 15:36:42 +00:00
Simon (Darkside) Jackson c2c098cad6
Merge pull request #460 from Unity-UI-Extensions/feature/2023testing
Feature/2023testing
2023-11-26 15:36:27 +00:00
SimonDarksideJ b171b2c1c2 Added extra event on the AutoCompleteComboBox, to fire when an item in the list is selected, with its display name
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/200
2023-11-26 15:26:11 +00:00
SimonDarksideJ a47d694796 Added argument to the UpdateLayout method for the HSS/VSS to move to a new starting page
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/451
2023-11-26 15:00:36 +00:00
SimonDarksideJ 9c7a59c9f2 Update to force Enumerated start for Accordion elements
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/455
2023-11-26 13:41:48 +00:00
SimonDarksideJ b615c4b681 Merge branch 'development' of https://github.com/Unity-UI-Extensions/com.unity.uiextensions into feature/2023testing 2023-11-26 09:53:51 +00:00
SimonDarksideJ 5eaf48d256 Made deprecated components obsolete rather than just remove to reduce errors for upgrades 2023-11-26 09:52:36 +00:00
action 518bc09602 Auto increment pre-release version to 2.3.2-pre.4 [skip ci] 2023-11-23 22:55:06 +00:00
Simon (Darkside) Jackson ad4ec2d920
Merge pull request #459 from Unity-UI-Extensions/feature/test-release
Feature/test-release
2023-11-23 22:48:13 +00:00
Simon (Darkside) Jackson aa4d41322e
Touch 2023-11-23 22:46:52 +00:00
Simon (Darkside) Jackson 0b8f1a0555
Merge pull request #458 from Unity-UI-Extensions/feature/2023testing
Feature/2023testing
2023-11-23 22:28:02 +00:00
SimonDarksideJ 162e4d3ed9 Updated implementations to handle 2023 support, with 2023 moving in to public release 2023-11-23 20:32:53 +00:00
SimonDarksideJ 54d951350a Merge branch 'release' of https://github.com/Unity-UI-Extensions/com.unity.uiextensions into development 2023-10-05 20:49:48 +01:00
Simon (Darkside) Jackson 1464ae97bd
fix missing using 2023-10-05 20:43:41 +01:00
SimonDarksideJ 250befb08c Merge branch 'release' of https://github.com/Unity-UI-Extensions/com.unity.uiextensions into development 2023-10-05 20:36:27 +01:00
SimonDarksideJ 3000e3b40b Merge branch 'release' of https://github.com/Unity-UI-Extensions/com.unity.uiextensions into release 2023-10-05 20:35:46 +01:00
SimonDarksideJ 9a823060a7 Update workflows 2023-10-05 20:35:32 +01:00
SimonDarksideJ 15cb41b838 deprecate CylinderText in 2022 2023-10-05 20:34:35 +01:00
Simon (Darkside) Jackson 322e804f25
Merge pull request #453 from RobTranquillo/release
Minor enhancements on DropDown
2023-10-05 16:53:52 +01:00
Simon (Darkside) Jackson 289a50d796
Minor review corrections 2023-10-05 16:53:04 +01:00
Robert Wartenberg 95f1956f48 fix: SetActive() takes care of btn. Add: ded. Hide funct 2023-09-25 14:31:45 +02:00
Robert Wartenberg 2a59f37653 fix: tabs vs. spaces in DropDownList { } 2023-09-25 14:31:41 +02:00
Robert Wartenberg c06cd38081 add: public accessable reset function 2023-09-25 14:31:37 +02:00
Simon (Darkside) Jackson 69c96ab471
Merge pull request #446 from wanliyun/release
Fix Bug!NeicerOutline color.a Lose when m_UseGraphicAlpha is true!
2023-07-22 16:53:23 +01:00
Simon (Darkside) Jackson 884a8d63f1
Update case sensitivity of agent labels 2023-07-22 16:45:39 +01:00
Simon (Darkside) Jackson 5f535e0431
Merge branch 'development' into release 2023-07-22 16:12:16 +01:00
Simon (Darkside) Jackson 17b69878de
Merge pull request #442 from sandr01d/development
Fix release date of v2.3
2023-07-22 16:11:54 +01:00
Simon (Darkside) Jackson 70f98806e9
Merge branch 'development' into release 2023-07-22 16:11:29 +01:00
Simon (Darkside) Jackson 90fd22498f
Merge pull request #444 from solidsign/feature/UIParticleSystem_use_lengthScale
Add using lengthScale to UIParticleSystem
2023-07-22 16:11:13 +01:00
Simon (Darkside) Jackson 0dd1e6d7bb
Merge branch 'release' into feature/UIParticleSystem_use_lengthScale 2023-07-22 16:10:37 +01:00
Simon (Darkside) Jackson 0a424334e9
Merge pull request #443 from adibacco/patch-1
Update UILineRenderer.cs
2023-07-22 16:10:26 +01:00
Simon (Darkside) Jackson 5ef4736e68
Merge branch 'development' into development 2023-07-22 16:09:32 +01:00
SimonDarksideJ 9fbcd39b88 Deprecated Text Effects with Unity 2022 as they are incompatible with TextMeshPro 2023-07-09 16:48:55 +01:00
wanliyun 6a68933e48 Fix Bug!NeicerOutline color.a Lose when m_UseGraphicAlpha is true!
if (m_UseGraphicAlpha)
    newColor.a = (byte)((newColor.a * verts[i].color.a) / 255);  //newColor's type cannot be Color.Should be Color32.
2023-07-06 13:20:50 +08:00
eldar.zakaryaev 11de683781 Fix UIParticleSystem does not correspond to runtime lengthScale change 2023-07-05 11:24:50 +03:00
eldar.zakaryaev 2a925fcf65 Add using lengthScale to UIParticleSystem 2023-07-05 11:11:44 +03:00
adibacco 34e3f82395
Update UILineRenderer.cs
There is no need to draw either points or segments. Both should be drawn.
2023-06-28 23:00:16 +02:00
Sandroid 4857492384 Fix release date of v2.3 2023-06-21 15:10:24 +02:00
SimonDarksideJ 796f66c310 Updated LineRenderer and UILIneConnector implementations to both be safer and include warning about placing a UILineRenderer at any other position than 0,0,0. 2023-06-17 18:33:22 +01:00
SimonDarksideJ e7babe0dd6 Updated HSS/VSS to ensure events fire correctly if the control is dragged but not moved:
Resolves: #186
2023-06-17 17:16:31 +01:00
action ab34212ade Auto increment pre-release version to 2.3.2-pre.3 [skip ci] 2023-03-29 13:41:56 +00:00
Simon (Darkside) Jackson 531059bf0e
Merge pull request #439 from Unity-UI-Extensions/feature/updateCodeOwners
Patch workflow for correct secret
2023-03-29 14:41:37 +01:00
Simon (Darkside) Jackson a4fb11f0b4
Patch workflow for correct secret 2023-03-29 14:32:05 +01:00
Simon (Darkside) Jackson 09b17fae52
Merge pull request #436 from victornor/linerenderer_points
Linerenderer points
2023-03-29 14:16:07 +01:00
Simon (Darkside) Jackson 7becb9cae4
Merge branch 'development' into linerenderer_points 2023-03-29 14:15:48 +01:00
Victor 7127f8bca7 chore: make CalculatePointOnCurve public 2023-03-20 13:43:43 +01:00
Victor ba7b21fdae feat: add CalculatePointOnCurve for linerenderer 2023-03-20 13:42:33 +01:00
victornor 5e7282c27d
fix: GetPosition when Segments is null 2023-03-20 13:33:14 +01:00
action 14aa9ae491 Auto increment pre-release version to 2.3.2-pre.2 [skip ci] 2023-03-12 12:13:16 +00:00
Simon (Darkside) Jackson a45509ee55
Merge pull request #435 from Unity-UI-Extensions/fix/resolveflowoverflow
Resolve FlowLayoutGroup overflow issue
2023-03-12 12:12:52 +00:00
Simon (Darkside) Jackson 2ccf119f7d
fix package version 2023-03-12 12:06:34 +00:00
SimonDarksideJ 14548049a5 Update workflows 2023-03-12 11:58:04 +00:00
SimonDarksideJ 02da81ef28 Resolves an issue where the last line in a flow layout group would overflow the rect bounds
Fixes - https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/432
2023-03-12 11:44:50 +00:00
SimonDarksideJ 3e8eaa0643 Merge branch 'development' of https://github.com/Unity-UI-Extensions/com.unity.uiextensions into development 2023-03-12 11:43:06 +00:00
Simon (Darkside) Jackson 8ddcaa839e
Merge pull request #434 from FejZa/release
Fix ResetSelectableHighlight resets button to normal when it's actually disabled
2023-03-02 17:43:55 +00:00
Simon (Darkside) Jackson c61fbeeceb
Merge branch 'development' into release 2023-03-02 17:42:42 +00:00
Simon (Darkside) Jackson d8c99e4398
Instigate development branch 2023-03-02 17:41:00 +00:00
Dino Fejzagić 8fc9e8aba5
Update ResetSelectableHighlight.cs 2023-03-01 11:32:14 +01:00
Simon Jackson d2b10980e3 Patch readme 2023-02-09 17:48:30 +00:00
Simon Jackson 688a879f31 Merge branch 'release' of https://github.com/Unity-UI-Extensions/com.unity.uiextensions into development 2023-02-07 14:59:14 +00:00
Simon (Darkside) Jackson ffdc0316a4
Merge branch 'release' into development 2023-02-07 14:56:38 +00:00
Simon (Darkside) Jackson 8384bd5ced
patchfix - erroneous namespace in combobox??? 2023-02-07 14:52:00 +00:00
Simon (Darkside) Jackson 649506cd3d
Set version to 2.3.0 for initial release 2023-02-07 14:33:47 +00:00
action 589e02ffaf Auto increment pre-release version to 2.3.0-pre-release.2 [skip ci] 2023-02-07 14:29:17 +00:00
action af10498e0e Auto increment pre-release version to 2.3.0-pre-release.1 [skip ci] 2023-02-07 14:08:42 +00:00
Simon (Darkside) Jackson 8cbd1c3c1e
Merge pull request #413 from Unity-UI-Extensions/feature/V2.3.0
Feature/v2.3.0
2023-02-07 14:06:08 +00:00
Simon Jackson 2a90891ee9 Final checks for merge! 2023-02-07 14:05:04 +00:00
Simon (Darkside) Jackson 28000ad5b7
Update pipelines for release 2023-02-07 12:07:01 +00:00
Simon (Darkside) Jackson 68edffc749
Merge branch 'release' into feature/V2.3.0 2023-02-06 14:11:17 +00:00
Simon Jackson 968fdab8cc Merge branch 'development' of https://github.com/Unity-UI-Extensions/com.unity.uiextensions into feature/V2.3.0 2023-02-06 14:07:44 +00:00
Simon Jackson e085cbe076 Resolved issues with DisplayAbove and using a 0 ItemsToDisplay 2023-02-06 13:32:05 +00:00
Simon Jackson b3bb76246b Merge branch 'feature/V2.3.0' of https://github.com/Unity-UI-Extensions/com.unity.uiextensions into feature/V2.3.0 2023-02-05 11:35:34 +00:00
Simon Jackson 33cd5a9be4 Several lifetime feature updates for the ComboBox controls:
- Resolves startup issue that prevented the control being used (Unity changed the start order in some instances), this was causing null reference issues with comboboxes
- Added the ability to set a specific item on start and not just the first
- Added the ability to disable the dropdown to make a read-only dropdown

Resolves:
- https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/426
- https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/425
2023-02-05 11:35:18 +00:00
Simon (Darkside) Jackson 30d50cc04e
Switch android builds to windows 2023-02-05 09:15:54 +00:00
Simon Jackson 9ce7661af6 Add 2019 to the testing validation 2023-02-04 19:25:13 +00:00
Simon Jackson b59f5132c3 Remove editor validation and add error checking for the ColorLabel component 2023-02-04 19:23:26 +00:00
Simon Jackson 8d18515a4a The BIG Unity 2022 Text reorganisation 2023-02-04 11:22:31 +00:00
Simon Jackson 1002db24f2 Resolves issue in 2022 with the missing Text component
Fixes: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/424
2023-02-04 10:30:40 +00:00
Simon Jackson 7545ab9fde Added ResetSelectableHighlight component 2023-02-01 15:10:40 +00:00
Simon Jackson 462eec558b Add the Version upgrade pipeline 2023-01-29 15:54:02 +00:00
Simon (Darkside) Jackson 5a14d4d3a4
Fix github issue templates 2023-01-29 10:18:25 +00:00
Simon Jackson 1c0c217931 Add updated test flow for builds 2023-01-29 10:12:08 +00:00
Simon Jackson 54a71dcf05 Updated NonDrawingGraphic to require a CanvasRender, else it causes an error on run (and doesn't work)
- Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/420
2023-01-26 14:21:17 +00:00
Simon Jackson 07ec98c989 Fix class spellings and update MultiTouchScrollRect 2023-01-22 17:26:01 +00:00
Simon Jackson e05bfb788d Added new submodule for extracted examples 2023-01-22 12:29:51 +00:00
Simon Jackson b752435eb7 Removed legacy Examples link, moving to separate repository 2023-01-22 12:26:52 +00:00
Simon Jackson c41b4af0e3 Revised the Curly UI fix as it was preventing the graphic from being updated in the scene view. Thanks to @solidsign for the update. 2023-01-22 10:40:29 +00:00
Simon Jackson 78d3b898c1 Updated build issue with ReorderableListElement 2023-01-03 19:22:19 +00:00
Simon Jackson 2f19deeb78 Updating GitHub artifacts and automation 2023-01-03 13:41:52 +00:00
Simon Jackson 696fc36926 Update Examples module to new home 2023-01-03 12:38:56 +00:00
Simon Jackson 84ec39aa6c Break Module 2023-01-03 12:27:43 +00:00
Simon Jackson 7e61dd398d Remove broken examples link 2023-01-03 12:26:53 +00:00
Simon Jackson 048fa7269f Refresh FancyScrollView with latest fixes 2023-01-03 12:25:02 +00:00
Simon Jackson 12f6174469 Cleanup and ensuring the UIParticleSystem is disposed on Destroy correctly.
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/412
2023-01-03 11:42:22 +00:00
Simon Jackson 60eed9b87a Base update for pointers to new version / package home 2023-01-01 16:56:37 +00:00
Simon Jackson fe97fa7599 Updated panel drawing for ComboBox controls and added DropdownOffset
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/393
2023-01-01 16:52:08 +00:00
Simon Jackson 9b23206c9a Updated ReorderableList/ReorderableListElement to prevent creating a "Fake" droppable when the item is not transferable
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/164
2023-01-01 16:13:40 +00:00
Simon Jackson 4b1c5412f1 Updated UIVerticalScroller for standards and added UIHorizontalScroller
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/205
2023-01-01 15:57:31 +00:00
Simon Jackson 70661a4823 Updated "Action" use to "UnityAction" to avoid Unity issues
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/253
2023-01-01 13:29:53 +00:00
Simon Jackson eceaa87e93 Clean-up of ScrollSnapBase 2023-01-01 13:22:53 +00:00
Simon Jackson c61e5b7e7c Added new FIFO based UI Line Render when dynamic line rendering is needed (basic, no Beziers)
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/324
2023-01-01 13:03:28 +00:00
Simon Jackson d1b94bf6f1 Updated initialisation logic to not cause an endless loop in the TabNavigationHelper
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/208
2023-01-01 12:16:33 +00:00
Simon Jackson 55489bd617 Updated Editor menu layout 2023-01-01 11:45:02 +00:00
Simon Jackson 2c5a7bb47f Updated Editor create options to add the correct Event System Input module for the Input system used, now or old.
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/378
2023-01-01 11:33:42 +00:00
Simon Jackson 1853ad7e89 Marked TileSizeFitter as obsolete as Unity has made this unworkable
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/214
2023-01-01 11:32:37 +00:00
Simon Jackson 4ffa631059 Added Editor Menu Option to create a Min/Max slider
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/270
2022-12-30 17:54:17 +00:00
Simon Jackson 2848008f63 Checking in new MinMaxSlider
TODO
- Finish Editor creator
2022-12-24 14:52:49 +00:00
Simon Jackson 3ed20ecaed Updated all components using "LayoutGroup" to override their OnDisable feature to incorporate this fix:
https://gist.github.com/randomize/73ca6d3b6aa7210073692eb5cabd537e

Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/178
2022-12-24 13:28:19 +00:00
Simon Jackson e78a2806ed Resolved issue whereby the last row in a flow layout group would not size correctly.
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/357
2022-12-24 13:20:19 +00:00
Simon Jackson 18ebf8121d Removed unneeded size calculation which caused some issues with mixed height/width children.
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/380
2022-12-24 13:09:26 +00:00
Simon Jackson dced045001 Updated ScrollPositionControllerEditor as obsolete too 2022-12-24 13:02:50 +00:00
Simon Jackson b4d9f08dc4 Marked ScrollPositionController as Obsolete, users should use the newer Scroller component instead, will be removed in a future release.
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/305
2022-12-24 12:54:57 +00:00
Simon Jackson 2a37530aea Added SetArc method to UICircle as requested
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/280
2022-12-24 12:49:39 +00:00
Simon Jackson 35c778f5f7 Protecting Remove too 2022-12-24 12:45:31 +00:00
Simon Jackson a317663268 Added error handling around setting Unity UI Components for Vertical/Horizontal scrolling
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/296
2022-12-24 12:44:23 +00:00
Simon Jackson 85ee380ee9 Updated Cooldown button to work with Keyboard input
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/171
2022-12-18 19:29:40 +00:00
Simon Jackson 00b67b7046 Updated Points to always be an array of 1 when set to nothing.
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/295
2022-12-18 18:09:58 +00:00
Simon Jackson c08a91f421 Hard reset of Colour picker guids 2022-11-27 16:54:19 +00:00
Simon Jackson 7de501c42b Add newly generated HSV picker meta files 2022-11-27 16:44:25 +00:00
Simon Jackson ebbed37836 Remove meta duplicates for HSVColour Picker 2022-11-27 16:42:34 +00:00
Simon Jackson 3dbd9261cd Updated Depth Texture sampler in UI Particles Shaders
Resolves:
- https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/401
2022-11-27 16:28:14 +00:00
Simon Jackson c2ada36c41 Updated Curly UI to wait until end of the frame to recalculate positions
Also updated Editor script to work in 2022

Resolves:
- https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/409
2022-11-27 15:14:52 +00:00
Simon Jackson c5a8af63f8 Updated UIVertical scroller to be 2022 compliant
Resolves:
- https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/410
2022-11-27 14:32:16 +00:00
Simon Jackson 8004bcf39b Updated #if filter inclusion to 2019_1_OR_Newer
resolves:
- https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/411
2022-11-27 13:51:39 +00:00
Simon Jackson afd645a470 Merged in fix/ReorderableListTransferability (pull request #137)
Fix IsTransferable behaviour of ReOrderable List Element
2022-04-23 22:38:00 +00:00
Simon Jackson 10e5273b31 Fixed issue which allowed an item marked as NOT transferable to actually be transferred between lists
Resolves #382
2022-04-23 23:36:50 +01:00
Simon Jackson a041f188b6 Merged in fix/UIConnectorAsPrefab (pull request #136)
UI Connector as Prefab fix
2022-04-23 22:26:27 +00:00
Simon Jackson 5db15808e2 Fixed the UIConnector to safely handle when no parent canvas can be found.
Resolves #392
2022-04-23 23:25:31 +01:00
Simon Jackson 30c5d8c1ff Merged in fix/UIParticleSystemUpdate (pull request #135)
Fix/UIParticleSystemUpdate
2022-04-23 22:13:29 +00:00
Simon Jackson c059e2338a Updated UIParticleSystem access to Particles array to ensure it is more stable.
Updated some #if statements to be better future proofed

Resolves #360
2022-04-23 23:12:42 +01:00
Simon Jackson 8a31713e46 Merge branch 'development' of https://github.com/Unity-UI-Extensions/com.unity.uiextensions into development 2022-04-23 21:26:05 +01:00
Simon Jackson 711ee02cb3 Merged in fix/StepperWarnings (pull request #134)
Fixed issue with SendMessage events raised by the Stepper control
2022-04-23 20:25:23 +00:00
Simon Jackson d0fbb28b05 Resolves #397
Moved OnValidate checks which redraw the component to the RectTransformDimensionsCHanged event
2022-04-23 21:24:18 +01:00
Simon Jackson 5bd7df19e1 Merged in fix/NextPreviousScrollsnapFix (pull request #133)
Scroll Snap buttons fix
2022-04-23 20:02:37 +00:00
Simon Jackson fc6ea6089d Fixes issue #398 where the Next / Previous buttons filed to work if the ScrollSnap was previously scrolling.
Also renamed the Extension Methods scripts and added a new function.

Resolves: #398
2022-04-23 21:01:37 +01:00
Simon Jackson 142582847b Remove old BitBucket Pipeline for GitHub 2022-04-23 14:59:49 +01:00
Simon Jackson 30b65fb979 Merged in fix manually because... Bitbucket
https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/pull-requests/130
2022-04-23 11:53:17 +01:00
Simon Jackson 3582824afa Applying PR manually, because Bitbucket
https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/pull-requests/128
2022-04-23 11:49:46 +01:00
Simon Jackson 771c7776c0 Taking in fix from
https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/pull-requests/132
2022-04-23 11:45:32 +01:00
Ben MacKinnon ca090d1797 Merged in RangeSlider-upgrade (pull request #131)
Upgraded RangeSlider to work in both Horizontal and Verticle setups, just like regular slider.

Approved-by: Simon Jackson
2022-04-23 10:43:01 +00:00
Ben MacKinnon 33568a6d67 Upgraded RangeSlider to work in both Horizontal and Verticle setups, just like regular slider.
Also fixed a minor issue with offset when dragging on the bar.

# Conflicts:
#	Runtime/Scripts/Controls/RangeSlider.cs
2022-03-21 18:32:08 +00:00
Simon Jackson d47b99ce0c Merged in feature/controlTouchUp (pull request #127)
Feature/controlTouchUp
2021-10-21 13:03:22 +00:00
Simon Jackson 056419a87b Updated Dropdown list to NOT resize text Rect on draw 2021-10-21 13:57:42 +01:00
Simon Jackson f101afbb29 Clean up range slider unused variables 2021-10-21 13:48:44 +01:00
Simon Jackson 3dae7181cd Merged in fix/infinitescrollcontentsize (pull request #126)
Fix/infinitescrollcontentsize
2021-09-05 14:43:46 +00:00
Simon Jackson 1a6181842a Merged in fix/ragesliderfix (pull request #125)
fix: Range slider low value stuck in max position
2021-09-05 14:43:29 +00:00
Simon Jackson 6333967b9a Patches from PR 2021-09-05 15:39:28 +01:00
Robert Rioja 9363fd3221 Merged in feature/improved-ui-highlightable (pull request #123)
Improved UI Highlightable Utility

Approved-by: Simon Jackson
2021-09-05 14:36:58 +00:00
Simon Jackson 1c68432e02 Clean-up and reset pivots on scene start 2021-09-05 15:33:24 +01:00
Simon Jackson 0410ca53d7 Updated Infinite scroll to work with content of different sizes 2021-09-05 15:23:48 +01:00
Simon Jackson 774f8de199 Resolves issue where the lower range value would become stuck when moved to the max value position
Resolves: https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/issues/381/cant-move-range-slider-if-low-is-moved-to
2021-09-05 09:33:19 +01:00
Simon Jackson b0f161a4e0 Update package preview release 2021-09-05 09:04:15 +01:00
Simon (Darkside) Jackson 830a4466eb Patch fix for UILineRenderer 2021-06-23 13:23:13 +01:00
Robert Rioja 0de91f60fb Added OnHighlightChanged and OnPressChanged events
Added getters and setters for Highlighted and Pressed
2021-05-27 18:38:47 +00:00
Simon (Darkside) Jackson dff07c6952 Package upver for Development 2021-05-10 20:42:38 +01:00
39 changed files with 1436 additions and 956 deletions

View File

@ -1,10 +1,10 @@
name: Build and test UPM packages for platforms on all available Unity Versions
name: Build and test UPM packages for platforms, all branches except main
on:
pull_request:
branches-ignore:
- 'release'
# Ignore PRs targetting main
# Ignore PRs targeting main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
@ -14,6 +14,7 @@ concurrency:
cancel-in-progress: true
jobs:
# Check Unity version required by the package
# Run Unity build unit tests defined in the package for a single version for feature branches
Run-Partial-Unit-Tests:
name: Run Unity Unit Tests
@ -26,12 +27,4 @@ jobs:
Run-Full-Unit-Tests:
name: Run Unity Unit Tests
if: github.ref == 'refs/heads/development'
uses: ./.github/workflows/rununitybuildmultiversion.yml
# Update the package release version
Update-Version:
name: Update Package Version
uses: ./.github/workflows/tagrelease.yml
with:
build-target: windows
secrets: inherit
uses: ./.github/workflows/rununitybuildmultiversion.yml

View File

@ -0,0 +1,26 @@
name: Publish development branch on Merge
on:
pull_request:
types:
- closed
branches:
- development
# On close of PR targeting development
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
release_on_merge:
if: github.event.pull_request.merged == true
name: Tag and Publish UPM package
uses: ./.github/workflows/upversionandtagrelease.yml
with:
build-host: ubuntu-latest
build-type: pre-release
secrets: inherit

View File

@ -0,0 +1,70 @@
name: Get the Package version from a UPM Package.json file
on:
workflow_call:
inputs:
build-host:
required: true
type: string
version-file-path:
description: 'Optional, specify a path to search for the upm package.json file. Use this if validation fails to find a valid package.json file.\n **Note, Version file MUST contain the attribute "Unity" with the full Unity version expected, e.g. "2020.2.3f1"'
type: string
required: false
outputs:
packageversion:
description: "Returns the version of the UPM package"
value: ${{ jobs.get_package_version.outputs.upmpackageversion }}
jobs:
get_package_version:
name: Get required Package version from UPM Package
runs-on: ${{ inputs.build-host }}
outputs:
upmpackageversion: ${{ steps.getVersion.outputs.packageversion }}
steps:
- name: Script Version
run: |
echo "::group::Script Versioning"
$scriptVersion = "1.0.0"
echo "Build Script Version: $scriptVersion"
echo "::endgroup::"
shell: pwsh
- uses: actions/checkout@v3
with:
submodules: recursive
clean: true
- id: getVersion
name: 'Get Package Version Number'
run: |
echo "::group::Validating input"
$versionFile = "${{ inputs.version-file-path }}"
if([string]::IsNullOrEmpty($versionFile))
{
echo 'version input was empty, using default'
$versionFile = 'package.json'
}
echo 'Checking for project json at $versionFile'
if ( -not (Test-Path -Path $versionFile) ) {
Write-Error "Failed to find a valid package.json file"
exit 1
}
echo "::endgroup::"
echo "::group::Package Version UPM check"
$package_json = Get-Content -Path $versionFile | ConvertFrom-Json
$packageVersion = $package_json.version
if([string]::IsNullOrEmpty($packageVersion)) {
Write-Error "Project.json version number does not exist or is empty"
exit 1
}
echo "packageversion=$packageVersion" >> $env:GITHUB_OUTPUT
echo "Detected version is $packageVersion"
echo "::endgroup::"
shell: pwsh

91
.github/workflows/main-publish.yml vendored Normal file
View File

@ -0,0 +1,91 @@
name: Publish main branch and increment version
on:
pull_request:
types:
- closed
branches:
- release
jobs:
# Get Version to tag and release the branch, no up-version - [no-ver] included in PR title
validate-environment:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.title, 'no-ver')
name: Get Version from UPM package
uses: ./.github/workflows/getpackageversionfrompackage.yml
with:
build-host: ubuntu-latest
# Perform tagging
release-Package-only:
needs: validate-environment
name: Release package only, no upversion
uses: ./.github/workflows/tagrelease.yml
with:
build-host: ubuntu-latest
version: ${{ needs.validate-environment.outputs.packageversion }}
secrets: inherit
# Up version the release and publish major release
upversion-major-Package:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.title, 'no-ver') == false && contains(github.event.pull_request.title, 'major-release')
name: Major Version package and release
uses: ./.github/workflows/upversionandtagrelease.yml
with:
build-host: ubuntu-latest
build-type: major
secrets: inherit
# Up version the release and publish minor release
upversion-minor-Package:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.title, 'no-ver') == false && contains(github.event.pull_request.title, 'minor-release')
name: Minor Version package and release
uses: ./.github/workflows/upversionandtagrelease.yml
with:
build-host: ubuntu-latest
build-type: minor
secrets: inherit
# Up version the release and publish patch release (default)
upversion-patch-Package:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.title, 'no-ver') == false && contains(github.event.pull_request.title, 'minor-release') == false && contains(github.event.pull_request.title, 'major-release') == false
name: Patch Version package and release
uses: ./.github/workflows/upversionandtagrelease.yml
with:
build-host: ubuntu-latest
build-type: patch-release
secrets: inherit
release-Complete:
if: ${{ always() }}
needs: [upversion-major-Package, upversion-minor-Package, upversion-patch-Package, release-Package-only]
name: Release complete
runs-on: ubuntu-latest
steps:
- name: Script Version
run: echo "Release done, updating Development"
# Refresh the development branch with the main publish
refresh-development:
if: ${{ always() }}
needs: [release-Complete]
name: Refresh development branch
uses: ./.github/workflows/refreshbranch.yml
with:
build-host: ubuntu-latest
target-branch: development
source-branch: main
secrets: inherit
# Up version the development branch ready for future development
upversion-development:
if: ${{ always() }}
needs: [refresh-development]
name: UpVersion the development branch for the next release
uses: ./.github/workflows/upversionandtagrelease.yml
with:
build-host: ubuntu-latest
build-type: patch
target-branch: development
createTag: false
secrets: inherit

43
.github/workflows/refreshbranch.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name: Refresh branch
on:
workflow_call:
inputs:
build-host:
required: true
type: string
target-branch:
required: true
type: string
source-branch:
required: true
type: string
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
packageRelease:
name: Refresh ${{ inputs.target-branch }} branch from ${{ inputs.source-branch }} branch
runs-on: ${{ inputs.build-host }}
steps:
- name: Script Version
run: |
echo "::group::Script Versioning"
$scriptVersion = "1.0.1"
echo "Build Script Version: $scriptVersion"
echo "::endgroup::"
shell: pwsh
- uses: actions/checkout@v3
with:
ref: ${{ inputs.target-branch }}
clean: true
token: ${{ secrets.GIT_PAT }}
- name: Refresh from Source Branch
run: |
git pull origin ${{ inputs.source-branch }}
git commit -m "Branch ${{ inputs.target-branch }} updated with changes from ${{ inputs.source-branch }} [skip ci]"
git push origin ${{ inputs.target-branch }}
echo "Branch ${{ inputs.target-branch }} updated with changes from ${{ inputs.source-branch }}"
shell: pwsh

View File

@ -18,7 +18,7 @@ jobs:
- os: windows
unityVersion: 2019.4
build-target: Android
- os: macos
- os: macOS
unityVersion: 2019.4
build-target: iOS
- os: windows
@ -30,7 +30,7 @@ jobs:
- os: windows
unityVersion: 2020.3
build-target: Android
- os: macos
- os: macOS
unityVersion: 2020.3
build-target: iOS
- os: windows
@ -42,7 +42,7 @@ jobs:
- os: windows
unityVersion: 2021.3
build-target: Android
- os: macos
- os: macOS
unityVersion: 2021.3
build-target: iOS
- os: windows
@ -52,17 +52,29 @@ jobs:
unityVersion: 2021.3
build-target: WSAPlayer
- os: windows
unityVersion: 2022.2
unityVersion: 2022.3
build-target: Android
- os: macos
unityVersion: 2022.2
- os: macOS
unityVersion: 2022.3
build-target: iOS
- os: windows
unityVersion: 2022.2
unityVersion: 2022.3
build-target: StandaloneWindows64
- os: windows
unityVersion: 2022.2
unityVersion: 2022.3
build-target: WSAPlayer
- os: windows
unityVersion: 2023.1
build-target: Android
- os: macOS
unityVersion: 2023.1
build-target: iOS
- os: windows
unityVersion: 2023.1
build-target: StandaloneWindows64
- os: windows
unityVersion: 2023.1
build-target: WSAPlayer
steps:
- name: Script Version
run: |
@ -80,7 +92,7 @@ jobs:
name: 'Run Unity Builds'
run: |
echo "::group::Set Hub and editor locations"
$unityVersion = ${{ matrix.unityVersion }}
$unityVersion = '${{ matrix.unityVersion }}'
echo "::group::Set Hub and editor locations"
@ -90,6 +102,7 @@ jobs:
$hubPath = "C:\Program Files\Unity Hub\Unity Hub.exe"
$editorRootPath = "C:\Program Files\Unity\Hub\Editor\"
$editorFileEx = "\Editor\Unity.exe"
$directorySeparatorChar = "\"
#"Unity Hub.exe" -- --headless help
#. 'C:\Program Files\Unity Hub\Unity Hub.exe' -- --headless help
@ -100,11 +113,12 @@ jobs:
}
elseif ( $global:PSVersionTable.OS.Contains("Darwin") )
{
$hubPath = "/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"
$hubPath = "/Applications/Unity Hub.app/Contents/macOS/Unity Hub"
$editorRootPath = "/Applications/Unity/Hub/Editor/"
$editorFileEx = "/Unity.app/Contents/MacOS/Unity"
$editorFileEx = "/Unity.app/Contents/macOS/Unity"
$directorySeparatorChar = "/"
# /Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless help
# /Applications/Unity\ Hub.app/Contents/macOS/Unity\ Hub -- --headless help
function unity-hub
{
& $hubPath -- --headless $args.Split(" ") | Out-String -NoNewline
@ -115,6 +129,7 @@ jobs:
$hubPath = "$HOME/Unity Hub/UnityHub.AppImage"
$editorRootPath = "$HOME/Unity/Hub/Editor/"
$editorFileEx = "/Editor/Unity"
$directorySeparatorChar = "/"
# /UnityHub.AppImage --headless help
# xvfb-run --auto-servernum "$HOME/Unity Hub/UnityHub.AppImage" --headless help
@ -126,8 +141,6 @@ jobs:
echo "::endgroup::"
echo "::group::Get String function to query a string for a value"
function GetString($InputString, $InputPattern, $MatchIndex)
@ -151,10 +164,9 @@ jobs:
echo "::endgroup::"
echo "::group::Get Installed Unity version based on Matrix"
echo 'Script Start'
echo "Unity hub path is {$hubPath}"
echo "Requested unity version is {$unityVersion}"
$InstalledUnityVersions = unity-hub editors
$editorRootPath = unity-hub ip -g
echo "Installed unity versions are {$InstalledUnityVersions}"
@ -171,7 +183,7 @@ jobs:
$queryUnityVersion = GetString $InstalledUnityVersions "$unityVersion" -MatchIndex 0
}
echo "Found unity version is {$queryUnityVersion}"
echo "Found unity version is {$queryUnityVersion} for input {$unityVersion}"
if ($queryUnityVersion -ne 0)
{
@ -218,7 +230,7 @@ jobs:
}
elseif ( $global:PSVersionTable.OS.Contains("Darwin") ) {
echo 'Building using Mac'
$editorFileEx = "/Unity.app/Contents/MacOS/Unity"
$editorFileEx = "/Unity.app/Contents/macOS/Unity"
$editorrunpath = Join-Path $editorRootPath $unityVersion $editorFileEx
function unity-editor {
@ -456,4 +468,4 @@ jobs:
if: always()
with:
name: unity-build-log
path: Logs/**
path: Logs/**

View File

@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
include:
- os: macos
- os: macOS
build-target: iOS
- os: windows
build-target: Android
@ -40,12 +40,11 @@ jobs:
with:
submodules: recursive
clean: true
- id: build
name: 'Run Unity Builds'
run: |
echo "::group::Set Hub and editor locations"
$unityVersion = ${{ inputs.unityVersion }}
$unityVersion = '${{ inputs.unityVersion }}'
echo "::group::Set Hub and editor locations"
@ -55,6 +54,7 @@ jobs:
$hubPath = "C:\Program Files\Unity Hub\Unity Hub.exe"
$editorRootPath = "C:\Program Files\Unity\Hub\Editor\"
$editorFileEx = "\Editor\Unity.exe"
$directorySeparatorChar = "\"
#"Unity Hub.exe" -- --headless help
#. 'C:\Program Files\Unity Hub\Unity Hub.exe' -- --headless help
@ -68,6 +68,7 @@ jobs:
$hubPath = "/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"
$editorRootPath = "/Applications/Unity/Hub/Editor/"
$editorFileEx = "/Unity.app/Contents/MacOS/Unity"
$directorySeparatorChar = "/"
# /Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless help
function unity-hub
@ -80,6 +81,7 @@ jobs:
$hubPath = "$HOME/Unity Hub/UnityHub.AppImage"
$editorRootPath = "$HOME/Unity/Hub/Editor/"
$editorFileEx = "/Editor/Unity"
$directorySeparatorChar = "/"
# /UnityHub.AppImage --headless help
# xvfb-run --auto-servernum "$HOME/Unity Hub/UnityHub.AppImage" --headless help
@ -91,8 +93,6 @@ jobs:
echo "::endgroup::"
echo "::group::Get String function to query a string for a value"
function GetString($InputString, $InputPattern, $MatchIndex)
@ -115,8 +115,7 @@ jobs:
}
echo "::endgroup::"
echo "::group::Get Installed Unity version based on Matrix"
echo 'Script Start'
echo "::group::Find Installed Unity version based on input"
echo "Unity hub path is {$hubPath}"
echo "Requested unity version is {$unityVersion}"
@ -136,7 +135,7 @@ jobs:
$queryUnityVersion = GetString $InstalledUnityVersions "$unityVersion" -MatchIndex 0
}
echo "Found unity version is {$queryUnityVersion}"
echo "Found unity version is {$queryUnityVersion} for input {$unityVersion}"
if ($queryUnityVersion -ne 0)
{
@ -421,4 +420,4 @@ jobs:
if: always()
with:
name: unity-build-log
path: Logs/**
path: Logs/**

View File

@ -1,33 +1,26 @@
name: Package UPM project and deploy
name: Tag Release
on:
workflow_call:
inputs:
build-target:
build-host:
required: true
type: string
version:
required: true
type: string
build-type:
required: false
default: 'pre-release'
type: string
# options:
# - major
# - minor
# - patch
# - pre-release
# - build
outputs:
packageversion:
description: "Returns the version of Unity the UPM package requires"
value: ${{ jobs.packageRelease.outputs.packageversion }}
secrets:
GIT_USER_NAME:
required: false
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
packageRelease:
name: Package UPM Project and tag
runs-on: ${{ inputs.build-target }}
runs-on: ${{ inputs.build-host }}
outputs:
packageversion: ${{ steps.getpackageversion.outputs.packageversion }}
steps:
@ -40,6 +33,7 @@ jobs:
shell: pwsh
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
clean: true
token: ${{ secrets.GIT_PAT }}
@ -60,87 +54,26 @@ jobs:
$gitUser = "${{ secrets.GIT_USER_NAME }}"
$gitEmail = "$gitUser@users.noreply.github.com"
}
echo "email $gitUser@users.noreply.github.com"
git config --global user.email "$gitUser@users.noreply.github.com"
git config --global user.name "$gitUser"
shell: pwsh
- id: getpackageversion
name: Bump UPM Package version
shell: pwsh
- name: Check if Tag Exists
run: |
function UpdateProjectVersionJSON {
param (
[Parameter(Mandatory)]
$type,
$packageFile = 'package.json'
)
<#
Type of build can be one of the following
- 'build' # Build release - 1.0.0-pre-release.0+1
- 'pre-release' # Pre-Release release - 1.0.0-pre-release.1
- 'patch' # Patch release - 1.0.1
- 'minor' # Minor release - 1.1.0
- 'major' # Major release - 2.0.0
#>
if ( -not (Test-Path -Path $packageFile) ) {
Write-Error "Failed to find a valid project manifest at `"$packageFile`""
return $null
$tagVersion = "${{ inputs.version }}"
$tags = git tag
echo "Tags found are [$tags], searching for [$tagVersion]"
foreach ($tag in $tags)
{
if($tag.Trim() -eq "$tagVersion")
{
Write-Error "$tagVersion tag already exists"
exit 1
}
$packageInfo = (Get-Content $packageFile -Raw) | ConvertFrom-Json
Write-Host "Detected Project Version:" $packageInfo.version
function IfNull($a, $b, $c) { if ($null -eq $a) { return $b } else { return $c } }
$packageSemVer = [System.Management.Automation.SemanticVersion]$packageInfo.version
$majorVersion = if($null -eq $packageSemVer.Major) {0} else {$packageSemVer.Major}
$minorVersion = if($null -eq $packageSemVer.Minor) {0} else {$packageSemVer.Minor}
$patchVersion = if($null -eq $packageSemVer.Patch) {0} else {$packageSemVer.Patch}
$prereleaseVersion = if($null -eq $packageSemVer.PreReleaseLabel) {0} else {$packageSemVer.PreReleaseLabel.Replace('pre-release.','')}
$buildVersion = if($null -eq $packageSemVer.BuildLabel) {0} else {$packageSemVer.BuildLabel}
# work out new version
switch ($type) {
'build' {
[int]$buildVersion += 1
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion, "pre-release." + $prereleaseVersion, $buildVersion)
}
'pre-release' {
[int]$prereleaseVersion += 1
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion, "pre-release." + $prereleaseVersion)
}
'patch' {
[int]$patchVersion += 1
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion)
}
'minor' {
[int]$minorVersion += 1
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, 0)
}
'major' {
[int]$majorVersion += 1
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, 0, 0)
}
}
Write-Host "Upgrading project version [$packageSemVer] to [$newPackageSemVer]"
# Write out updated package info
$packageInfo.version = $newPackageSemVer.ToString()
$packageInfo | ConvertTo-Json | Set-Content $packageFile
return $packageInfo.version
}
$packageFile = 'package.json'
$result = UpdateProjectVersionJSON("${{ inputs.build-type }}","$packageFile")
if([string]::IsNullOrEmpty($result)) {
echo "Version patch failed"
exit 1
}
echo "packageversion=$result" >> $env:GITHUB_OUTPUT
git add "$packageFile"
git commit -m "Auto increment pre-release version to $result [skip ci]"
git tag -fa "$result" "${GITHUB_SHA}" -m "$result Release"
git push origin --force
shell: pwsh
shell: pwsh
- name: Create tag and push
run: |
$tagVersion = "${{ inputs.version }}"
git tag -fa "v$tagVersion" "${GITHUB_SHA}" -m "v$tagVersion Release [skip ci]"
git push origin "v$tagVersion" --force
shell: pwsh

View File

@ -0,0 +1,181 @@
name: UpVersion Package UPM project and create new tag
on:
workflow_call:
inputs:
build-host:
required: true
type: string
build-type:
required: false
default: 'pre-release'
type: string
# options:
# - major
# - minor
# - patch
# - patch-release
# - pre-release
# - build
target-branch:
required: false
type: string
default: ${{ github.ref }}
createTag:
required: false
type: boolean
default: true
outputs:
packageversion:
description: "Returns the version of Unity the UPM package requires"
value: ${{ jobs.packageRelease.outputs.packageversion }}
secrets:
GIT_PAT:
required: true
jobs:
packageRelease:
name: Package UPM Project and tag
runs-on: ${{ inputs.build-host }}
outputs:
packageversion: ${{ steps.getpackageversion.outputs.packageversion }}
steps:
- name: Script Version
run: |
echo "::group::Script Versioning"
$scriptVersion = "1.0.2"
echo "Build Script Version: $scriptVersion"
echo "::endgroup::"
shell: pwsh
- uses: actions/checkout@v3
with:
ref: ${{ inputs.target-branch }}
fetch-depth: 0
submodules: recursive
clean: true
token: ${{ secrets.GIT_PAT }}
- uses: actions/setup-node@v3
- name: Set Github vars
run: |
if([string]::IsNullOrEmpty('${{ secrets.GIT_USER_NAME }}')){
if([string]::IsNullOrEmpty('${{ secrets.GIT_USER_NAME }}')){
$gitUser = "action"
$gitEmail = "action@github.com"
}
else {
$gitUser = "${GITHUB_ACTOR}"
$gitEmail = "$gitUser@users.noreply.github.com"
}
}
else {
$gitUser = "${{ secrets.GIT_USER_NAME }}"
$gitEmail = "$gitUser@users.noreply.github.com"
}
git config --global user.email "$gitUser@users.noreply.github.com"
git config --global user.name "$gitUser"
shell: pwsh
- id: getpackageversion
name: Bump UPM Package version
run: |
function UpdateProjectVersionJSON {
param (
[Parameter(Mandatory)]
$type,
$packageFile = 'package.json'
)
<#
Type of build can be one of the following
- 'build' # Build release - 1.0.0-pre.0+1
- 'pre-release' # Pre-Release - 1.0.0-pre.1
- 'patch-release' # Patch release - 1.0.1 (reset preview version to current patch, no increase)
- 'patch' # Patch release - 1.0.1
- 'minor' # Minor release - 1.1.0
- 'major' # Major release - 2.0.0
#>
if ( -not (Test-Path -Path $packageFile) ) {
Write-Error "Failed to find a valid project manifest at `"$packageFile`""
return $null
}
$packageInfo = (Get-Content $packageFile -Raw) | ConvertFrom-Json
Write-Host "Detected Project Version:" $packageInfo.version
function IfNull($a, $b, $c) { if ($null -eq $a) { return $b } else { return $c } }
$packageSemVer = [System.Management.Automation.SemanticVersion]$packageInfo.version
$majorVersion = if($null -eq $packageSemVer.Major) {0} else {$packageSemVer.Major}
$minorVersion = if($null -eq $packageSemVer.Minor) {0} else {$packageSemVer.Minor}
$patchVersion = if($null -eq $packageSemVer.Patch) {0} else {$packageSemVer.Patch}
$prereleaseVersion = if($null -eq $packageSemVer.PreReleaseLabel) {0} else {$packageSemVer.PreReleaseLabel.Replace('pre.','')}
$buildVersion = if($null -eq $packageSemVer.BuildLabel) {0} else {$packageSemVer.BuildLabel}
# work out new version
switch ($type) {
'build' {
[int]$buildVersion += 1
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion, "pre." + $prereleaseVersion, $buildVersion)
}
'pre-release' {
[int]$prereleaseVersion += 1
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion, "pre." + $prereleaseVersion)
}
'patch-release' {
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion)
}
'patch' {
[int]$patchVersion += 1
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, $patchVersion)
}
'minor' {
[int]$minorVersion += 1
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, $minorVersion, 0)
}
'major' {
[int]$majorVersion += 1
$newPackageSemVer = [System.Management.Automation.SemanticVersion]::New($majorVersion, 0, 0)
}
}
Write-Host "Upgrading project version [$packageSemVer] to [$newPackageSemVer]"
# Write out updated package info
$packageInfo.version = $newPackageSemVer.ToString()
$packageInfo | ConvertTo-Json | Set-Content $packageFile
return $packageInfo.version
}
$packageFile = 'package.json'
$result = UpdateProjectVersionJSON("${{ inputs.build-type }}","$packageFile")
if([string]::IsNullOrEmpty($result)) {
echo "Version patch failed"
exit 1
}
git add "$packageFile"
git commit -m "Auto increment pre-release version to $result [skip ci]"
git push origin
echo "packageversion=$result" >> $env:GITHUB_OUTPUT
shell: pwsh
- name: Check if Tag Exists
run: |
$tagVersion = '${{steps.getpackageversion.outputs.packageversion }}'
$tags = git tag
echo "Tags found are [$tags], searching for [$tagVersion]"
foreach ($tag in $tags)
{
if($tag.Trim() -eq "$tagVersion")
{
Write-Error "$tagVersion tag already exists"
exit 1
}
}
shell: pwsh
- name: Publish package tag
if: ${{inputs.createTag == true}}
run: |
$outputVersion = '${{steps.getpackageversion.outputs.packageversion }}'
git tag -fa "v$outputVersion" "${GITHUB_SHA}" -m "v$outputVersion Release"
git push origin "v$outputVersion" --force --tags
shell: pwsh

2
.gitignore vendored
View File

@ -33,3 +33,5 @@ sysinfo.txt
*.apk
*.unitypackage
/.vs
**/node_modules/*

View File

@ -4,17 +4,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/).
## Release 2.3 - Reanimation - 2022/02/07
## Release 2.3.2 - Rejuvenation - 2023/11/26
It has been a tough time for all since the last update, but things have been moving steadily along. In the past few months there has been a concerted effort to revamp and update the project ready for Unity 2022, as well as migrating the source repository over to GitHub and refreshing all the things.
We hope the new release is better for everyone and we have paid close attention to the editor menus and places to find all the controls for this release.
2023 is certainly an interesting year to keep you on your toes, and finding time to keep managing all the requests and updates that come in are taking their toll, especially for a FREE project, but nonetheless, I still do it.
Mainly bugfixes for the end of year update, promoting some resolutions that have been verified and tested since the last release.
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:
>
> - [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
> - [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
@ -28,64 +29,23 @@ For more details, see the [deprecation notice](https://github.com/Unity-UI-Exten
## Added
- Added new FIFO based UI Line Render when dynamic line rendering is needed.
- Added ResetSelectableHighlight component.
- Added SetArc method to UICircle as requested.
- Added new UIHorizontalScroller based on UIVerticalScroller.
- Added OnHighlightChanged and OnPressChanged events for UI Button.
- Added error handling around setting Unity UI Components for Vertical/Horizontal ScrollSnaps.
- Added Editor Menu Option to create a Min/Max slider.
- Added the ability to set a specific item for combobox controls on start and not just the first.
- Added the ability to disable the combo boxes and make them read-only.
- Add CalculatePointOnCurve for uilinerenderer (@victornor)
## Changed
- Refresh FancyScrollView with the latest fixes
- All Text based components updated to use TextMeshPro from Unity 2022 **Breaking Change**
- Clean-up and reset pivots on scene start.
- Merged in feature/improved-ui-highlightable (pull request UILineRenderer - issues with specifying point locations at runtime #123).
- Merged in fix/rangesliderfix (pull request HorizontalScrollSnap Mask Area doesn't work when content created dynamically #125).
- Merged in fix/infinitescrollcontentsize (pull request Gradient initialization should be in Awake() #126).
- Merged in feature/controlTouchUp (pull request UILineRenderer mesh not updating in Editor scene view #127).
- Upgraded RangeSlider to work in both Horizontal and Vertical setups.
- Merged in RangeSlider-upgrade. (pull request Newtonsoft.Json.dll conflict #131)
- Updated UIVertical scroller to be 2022 compliant.
- Updated Curly UI to wait until end of the frame to recalculate positions.
- Updated Depth Texture sampler in UI Particles Shaders.
- Updated Points to always be an array of 1 when set to nothing for the Line Renderer.
- Updated Cooldown button to work with Keyboard input.
- Removed unneeded size calculation which caused some issues with mixed content.
- Resolved an issue whereby the last row in a flow layout group would not size correctly.
- Updated all components using "LayoutGroup" to override their OnDisable.
- Updated validation in the new MinMaxSlider.
- Updated Editor create options to add the correct Event System Input manager.
- Updated initialisation logic to not cause an endless loop in the TabNavigationHelper.
- Updated "Action" use to "UnityAction" to avoid Unity issues for DropDowns.
- Updated UIVerticalScroller for standards.
- Updated ReorderableList/ReorderableListElement to prevent creating a fake object for non-transferable items.
- Updated panel drawing for ComboBox controls and added DropdownOffset.
- Updated build issue with ReorderableListElement.
- Updated NonDrawingGraphic to require a CanvasRender, else it causes an error on run.
- fix: Fixed an null reference exception with the ResetSelectableHighlight (@FejZa)
- fix: Resolved an issue where the last line in a flow layout group would overflow the rect bounds.
- fix: GetPosition when Segments is null (@victornor)
- fix: Fix Bug! NicerOutline color.a Loss when m_UseGraphicAlpha is true (wanliyun)
- fix: Update to force Enumerated start for Accordion elements, Resolves: #455
- Added argument to the UpdateLayout method for the HSS/VSS to move to a new starting page.
- Updated implementations to handle 2023 support, with 2023 moving in to public release.
- Added extra event on the AutoCompleteComboBox, to fire when an item in the list is selected, with its display name.
- FlowLayoutGroup components updated to latest (likely the last as the author has stopped development)
## Deprecated
- Marked ScrollPositionController as Obsolete, users should use the new Scoller.
- BestFitOutline - Deprecated in Unity 2020 onwards. (still available for earlier versions)
- NicerOutline - Deprecated in Unity 2020 onwards. (still available for earlier versions)
- Marked TileSizeFitter as obsolete as Unity has made this unworkable.
## Fixed
- Resolved issues with DisplayAbove and using a 0 ItemsToDisplay for ComboBox controls.
- Resolved startup issue that prevented the control from being used (Unity changed the start order in some instances), this was causing null reference issues with comboboxes.
- Patch fix for UILineRenderer.
- Resolves issue where the lower range value would become stuck when moving.
- Updated Infinite scroll to work with content of different sizes.
- Updated Dropdown list to NOT resize text Rect on draw.
- Revised the Curly UI fix as it was preventing the graphic from being updated in the scene view.
- Cleanup and ensuring the UIParticleSystem is disposed in onDestroy correctly.
- Clean up range slider unused variables.
- All deprecated Text based components now have "obsolete" tags, to avoid breaking code. Note, these do not function in 2022 and above, as Unity have "changed" things. For any affected component, I recommend updating to use TextMeshPro native features.
## Additional Notes
@ -98,6 +58,7 @@ New for 2020, we have added OpenUPM support and the package can be installed usi
```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

View File

@ -42,17 +42,18 @@ This version of the Unity UI Extensions is compatible with the following version
## [Release Notes](https://unity-ui-extensions.github.io/ReleaseNotes/RELEASENOTES)
## Release 2.3 - Reanimation - 2022/02/07
## Release 2.3.2 - Rejuvenation - 2023/11/26
It has been a tough time for all since the last update, but things have been moving steadily along. In the past few months there has been a concerted effort to revamp and update the project ready for Unity 2022, as well as migrating the source repository over to GitHub and refreshing all the things.
We hope the new release is better for everyone and we have paid close attention to the editor menus and places to find all the controls for this release.
2023 is certainly an interesting year to keep you on your toes, and finding time to keep managing all the requests and updates that come in are taking their toll, especially for a FREE project, but nonetheless, I still do it.
Mainly bugfixes for the end of year update, promoting some resolutions that have been verified and tested since the last release.
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:
>
> - [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
> - [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
@ -66,64 +67,23 @@ For more details, see the [deprecation notice](https://github.com/Unity-UI-Exten
## Added
- Added new FIFO based UI Line Render when dynamic line rendering is needed.
- Added ResetSelectableHighlight component.
- Added SetArc method to UICircle as requested.
- Added new UIHorizontalScroller based on UIVerticalScroller.
- Added OnHighlightChanged and OnPressChanged events for UI Button.
- Added error handling around setting Unity UI Components for Vertical/Horizontal ScrollSnaps.
- Added Editor Menu Option to create a Min/Max slider.
- Added the ability to set a specific item for combobox controls on start and not just the first.
- Added the ability to disable the combo boxes and make them read-only.
- Add CalculatePointOnCurve for uilinerenderer (@victornor)
## Changed
- Refresh FancyScrollView with the latest fixes
- All Text based components updated to use TextMeshPro from Unity 2022 **Breaking Change**
- Clean-up and reset pivots on scene start.
- Merged in feature/improved-ui-highlightable (pull request UILineRenderer - issues with specifying point locations at runtime #123).
- Merged in fix/ragesliderfix (pull request HorizontalScrollSnap Mask Area doesn't work when content created dynamically #125).
- Merged in fix/infinitescrollcontentsize (pull request Gradient initialization should be in Awake() #126).
- Merged in feature/controlTouchUp (pull request UILineRenderer mesh not updating in Editor scene view #127).
- Upgraded RangeSlider to work in both Horizontal and Vertical setups.
- Merged in RangeSlider-upgrade. (pull request Newtonsoft.Json.dll conflict #131)
- Updated UIVertical scroller to be 2022 compliant.
- Updated Curly UI to wait until end of the frame to recalculate positions.
- Updated Depth Texture sampler in UI Particles Shaders.
- Updated Points to always be an array of 1 when set to nothing for the Line Renderer.
- Updated Cooldown button to work with Keyboard input.
- Removed unneeded size calculation which caused some issues with mixed content.
- Resolved an issue whereby the last row in a flow layout group would not size correctly.
- Updated all components using "LayoutGroup" to override their OnDisable.
- Updated validation in the new MinMaxSlider.
- Updated Editor create options to add the correct Event System Input manager.
- Updated initialisation logic to not cause an endless loop in the TabNavigationHelper.
- Updated "Action" use to "UnityAction" to avoid Unity issues for DropDowns.
- Updated UIVerticalScroller for standards.
- Updated ReorderableList/ReorderableListElement to prevent creating a fake object for non-transferable items.
- Updated panel drawing for ComboBox controls and added DropdownOffset.
- Updated build issue with ReorderableListElement.
- Updated NonDrawingGraphic to require a CanvasRender, else it causes an error on run.
- fix: Fixed an null reference exception with the ResetSelectableHighlight (@FejZa)
- fix: Resolved an issue where the last line in a flow layout group would overflow the rect bounds.
- fix: GetPosition when Segments is null (@victornor)
- fix: Fix Bug! NicerOutline color.a Loss when m_UseGraphicAlpha is true (wanliyun)
- fix: Update to force Enumerated start for Accordion elements, Resolves: #455
- Added argument to the UpdateLayout method for the HSS/VSS to move to a new starting page.
- Updated implementations to handle 2023 support, with 2023 moving in to public release.
- Added extra event on the AutoCompleteComboBox, to fire when an item in the list is selected, with its display name.
- FlowLayoutGroup components updated to latest (likely the last as the author has stopped development)
## Deprecated
- Marked ScrollPositionController as Obsolete, users should use the new Scoller.
- BestFitOutline - Deprecated in Unity 2020 onwards. (still available for earlier versions)
- NicerOutline - Deprecated in Unity 2020 onwards. (still available for earlier versions)
- Marked TileSizeFitter as obsolete as Unity has made this unworkable.
## Fixed
- Resolved issues with DisplayAbove and using a 0 ItemsToDisplay for ComboBox controls.
- Resolved startup issue that prevented the control from being used (Unity changed the start order in some instances), this was causing null reference issues with comboboxes.
- Patch fix for UILineRenderer.
- Resolves issue where the lower range value would become stuck when moving.
- Updated Infinite scroll to work with content of different sizes.
- Updated Dropdown list to NOT resize text Rect on draw.
- Revised the Curly UI fix as it was preventing the graphic from being updated in the scene view.
- Cleanup and ensuring the UIParticleSystem is disposed in onDestroy correctly.
- Clean up range slider unused variables.
- All deprecated Text based components now have "obsolete" tags, to avoid breaking code. Note, these do not function in 2022 and above, as Unity have "changed" things. For any affected component, I recommend updating to use TextMeshPro native features.
- [UI Extensions Issue log](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues)

View File

@ -29,7 +29,11 @@ namespace UnityEngine.UI.Extensions
void ObtainCanvasGroups()
{
#if UNITY_2023_1_OR_NEWER
canvasGroups = GameObject.FindObjectsByType<CanvasGroup>(FindObjectsSortMode.None);
#else
canvasGroups = GameObject.FindObjectsOfType<CanvasGroup>();
#endif
}
void OnGUI()

View File

@ -159,7 +159,11 @@ namespace UnityEditor.UI
private static void CreateEventSystem(bool select, GameObject parent)
{
#if UNITY_2023_1_OR_NEWER
var esys = Object.FindFirstObjectByType<EventSystem>();
#else
var esys = Object.FindObjectOfType<EventSystem>();
#endif
if (esys == null)
{
var eventSystem = new GameObject("EventSystem");
@ -191,7 +195,11 @@ namespace UnityEditor.UI
return canvas.gameObject;
// No canvas in selection or its parents? Then use just any canvas..
#if UNITY_2023_1_OR_NEWER
canvas = Object.FindFirstObjectByType<Canvas>();
#else
canvas = Object.FindObjectOfType(typeof(Canvas)) as Canvas;
#endif
if (canvas != null && canvas.gameObject.activeInHierarchy)
return canvas.gameObject;
@ -1121,7 +1129,7 @@ namespace UnityEditor.UI
mainButtonRT.anchorMin = Vector2.zero;
mainButtonRT.anchorMax = Vector2.one;
mainButtonRT.sizeDelta = Vector2.zero;
Events.UnityEventTools.AddBoolPersistentListener(mainButton.GetComponent<Button>().onClick, new UnityEngine.Events.UnityAction<bool>(dropDownList.ToggleDropdownPanel), true);
Events.UnityEventTools.AddPersistentListener(mainButton.GetComponent<Button>().onClick, dropDownList.ToggleDropdownPanel);
var mainButtonText = mainButton.GetComponentInChildren<Text>();
mainButtonText.alignment = TextAnchor.MiddleLeft;
mainButtonText.text = "Select Item...";
@ -1149,7 +1157,7 @@ namespace UnityEditor.UI
overlayRT.sizeDelta = new Vector2(0f, 1f);
overlayRT.pivot = new Vector2(0f, 1f);
overlay.AddComponent<Image>().color = new Color(0.243f, 0.871f, 0f, 0f);
Events.UnityEventTools.AddBoolPersistentListener(overlay.AddComponent<Button>().onClick, new UnityEngine.Events.UnityAction<bool>(dropDownList.ToggleDropdownPanel), true);
Events.UnityEventTools.AddPersistentListener(overlay.AddComponent<Button>().onClick, dropDownList.ToggleDropdownPanel);
//Overlay Scroll Panel
var overlayScrollPanelRT = overlayScrollPanel.GetComponent<RectTransform>();
overlayScrollPanelRT.position += new Vector3(0, -cbbRT.sizeDelta.y, 0);
@ -1257,7 +1265,11 @@ namespace UnityEditor.UI
private static void CreateToolTipItem(bool select, GameObject parent)
{
#if UNITY_2023_1_OR_NEWER
var btti = Object.FindFirstObjectByType<BoundTooltipItem>();
#else
var btti = Object.FindObjectOfType<BoundTooltipItem>();
#endif
if (btti == null)
{
var boundTooltipItem = CreateUIObject("ToolTipItem", parent.GetComponentInParent<Canvas>().gameObject);

View File

@ -6,7 +6,7 @@ namespace UnityEngine.UI.Extensions
{
public static class uGUITools
{
[MenuItem("uGUI/Anchors to Corners %[")]
[MenuItem("Tools/UnityUIExtensions/Anchors to Corners %[")]
static void AnchorsToCorners()
{
if (Selection.transforms == null || Selection.transforms.Length == 0)
@ -37,7 +37,7 @@ namespace UnityEngine.UI.Extensions
Undo.CollapseUndoOperations(undoGroup);
}
[MenuItem("uGUI/Corners to Anchors %]")]
[MenuItem("Tools/UnityUIExtensions/Corners to Anchors %]")]
static void CornersToAnchors()
{
if (Selection.transforms == null || Selection.transforms.Length == 0)
@ -60,13 +60,13 @@ namespace UnityEngine.UI.Extensions
Undo.CollapseUndoOperations(undoGroup);
}
[MenuItem("uGUI/Mirror Horizontally Around Anchors %;")]
[MenuItem("Tools/UnityUIExtensions/Mirror Horizontally Around Anchors %;")]
static void MirrorHorizontallyAnchors()
{
MirrorHorizontally(false);
}
[MenuItem("uGUI/Mirror Horizontally Around Parent Center %:")]
[MenuItem("Tools/UnityUIExtensions/Mirror Horizontally Around Parent Center %:")]
static void MirrorHorizontallyParent()
{
MirrorHorizontally(true);
@ -96,13 +96,13 @@ namespace UnityEngine.UI.Extensions
}
}
[MenuItem("uGUI/Mirror Vertically Around Anchors %'")]
[MenuItem("Tools/UnityUIExtensions/Mirror Vertically Around Anchors %'")]
static void MirrorVerticallyAnchors()
{
MirrorVertically(false);
}
[MenuItem("uGUI/Mirror Vertically Around Parent Center %\"")]
[MenuItem("Tools/UnityUIExtensions/Mirror Vertically Around Parent Center %\"")]
static void MirrorVerticallyParent()
{
MirrorVertically(true);

@ -1 +1 @@
Subproject commit 2b2dba57650838e285c3336b4a26847931462570
Subproject commit 1cfaa42b3fcc454950009cc03a8280fd18e38197

View File

@ -4,6 +4,11 @@ This is an extension project for the new Unity UI system which can be found at:
> [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&registry_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:
@ -29,7 +34,7 @@ In this repository is a collection of extension scripts / effects and controls t
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 - 2019.6 (aka 2.5)](https://unity-ui-extensions.github.io/Downloads)
## [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.
@ -69,17 +74,18 @@ To get started with the project, here's a little guide:
## [Updates:](https://unity-ui-extensions.github.io/ReleaseNotes/RELEASENOTES)
## Release 2.3 - Reanimation - 2022/02/07
## Release 2.3.2 - Rejuvenation - 2023/11/26
It has been a tough time for all since the last update, but things have been moving steadily along. In the past few months there has been a concerted effort to revamp and update the project ready for Unity 2022, as well as migrating the source repository over to GitHub and refreshing all the things.
We hope the new release is better for everyone and we have paid close attention to the editor menus and places to find all the controls for this release.
2023 is certainly an interesting year to keep you on your toes, and finding time to keep managing all the requests and updates that come in are taking their toll, especially for a FREE project, but nonetheless, I still do it.
Mainly bugfixes for the end of year update, promoting some resolutions that have been verified and tested since the last release.
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:
>
> - [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
> - [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
@ -93,66 +99,25 @@ For more details, see the [deprecation notice](https://github.com/Unity-UI-Exten
## Added
- Added new FIFO based UI Line Render when dynamic line rendering is needed.
- Added ResetSelectableHighlight component.
- Added SetArc method to UICircle as requested.
- Added new UIHorizontalScroller based on UIVerticalScroller.
- Added OnHighlightChanged and OnPressChanged events for UI Button.
- Added error handling around setting Unity UI Components for Vertical/Horizontal ScrollSnaps.
- Added Editor Menu Option to create a Min/Max slider.
- Added the ability to set a specific item for combobox controls on start and not just the first.
- Added the ability to disable the combo boxes and make them read-only.
- Add CalculatePointOnCurve for uilinerenderer (@victornor)
## Changed
- Refresh FancyScrollView with the latest fixes
- All Text based components updated to use TextMeshPro from Unity 2022 **Breaking Change**
- Clean-up and reset pivots on scene start.
- Merged in feature/improved-ui-highlightable (pull request UILineRenderer - issues with specifying point locations at runtime #123).
- Merged in fix/ragesliderfix (pull request HorizontalScrollSnap Mask Area doesn't work when content created dynamically #125).
- Merged in fix/infinitescrollcontentsize (pull request Gradient initialization should be in Awake() #126).
- Merged in feature/controlTouchUp (pull request UILineRenderer mesh not updating in Editor scene view #127).
- Upgraded RangeSlider to work in both Horizontal and Vertical setups.
- Merged in RangeSlider-upgrade. (pull request Newtonsoft.Json.dll conflict #131)
- Updated UIVertical scroller to be 2022 compliant.
- Updated Curly UI to wait until end of the frame to recalculate positions.
- Updated Depth Texture sampler in UI Particles Shaders.
- Updated Points to always be an array of 1 when set to nothing for the Line Renderer.
- Updated Cooldown button to work with Keyboard input.
- Removed unneeded size calculation which caused some issues with mixed content.
- Resolved an issue whereby the last row in a flow layout group would not size correctly.
- Updated all components using "LayoutGroup" to override their OnDisable.
- Updated validation in the new MinMaxSlider.
- Updated Editor create options to add the correct Event System Input manager.
- Updated initialisation logic to not cause an endless loop in the TabNavigationHelper.
- Updated "Action" use to "UnityAction" to avoid Unity issues for DropDowns.
- Updated UIVerticalScroller for standards.
- Updated ReorderableList/ReorderableListElement to prevent creating a fake object for non-transferable items.
- Updated panel drawing for ComboBox controls and added DropdownOffset.
- Updated build issue with ReorderableListElement.
- Updated NonDrawingGraphic to require a CanvasRender, else it causes an error on run.
- fix: Fixed an null reference exception with the ResetSelectableHighlight (@FejZa)
- fix: Resolved an issue where the last line in a flow layout group would overflow the rect bounds.
- fix: GetPosition when Segments is null (@victornor)
- fix: Fix Bug! NicerOutline color.a Loss when m_UseGraphicAlpha is true (wanliyun)
- fix: Update to force Enumerated start for Accordion elements, Resolves: #455
- Added argument to the UpdateLayout method for the HSS/VSS to move to a new starting page.
- Updated implementations to handle 2023 support, with 2023 moving in to public release.
- Added extra event on the AutoCompleteComboBox, to fire when an item in the list is selected, with its display name.
- FlowLayoutGroup components updated to latest (likely the last as the author has stopped development)
## Deprecated
- Marked ScrollPositionController as Obsolete, users should use the new Scoller.
- BestFitOutline - Deprecated in Unity 2020 onwards. (still available for earlier versions)
- NicerOutline - Deprecated in Unity 2020 onwards. (still available for earlier versions)
- Marked TileSizeFitter as obsolete as Unity has made this unworkable.
- All deprecated Text based components now have "obsolete" tags, to avoid breaking code. Note, these do not function in 2022 and above, as Unity have "changed" things. For any affected component, I recommend updating to use TextMeshPro native features.
## Fixed
- Resolved issues with DisplayAbove and using a 0 ItemsToDisplay for ComboBox controls.
- Resolved startup issue that prevented the control from being used (Unity changed the start order in some instances), this was causing null reference issues with comboboxes.
- Patch fix for UILineRenderer.
- Resolves issue where the lower range value would become stuck when moving.
- Updated Infinite scroll to work with content of different sizes.
- Updated Dropdown list to NOT resize text Rect on draw.
- Revised the Curly UI fix as it was preventing the graphic from being updated in the scene view.
- Cleanup and ensuring the UIParticleSystem is disposed in onDestroy correctly.
- Clean up range slider unused variables.
* [UI Extensions Issue log](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues)
- [UI Extensions Issue log](https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues)
## Upgrade Notes
@ -209,6 +174,8 @@ There are almost 70+ extension controls / effect and other utilities in the proj
|NicerOutline|RaycastMask|UIFlippable|UIImageCrop|SoftAlphaMask|
|CylinderText|UIParticleSystem|CurlyUI|Shine Effect|Shader Effects|
> Text Effects 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|
@ -249,9 +216,9 @@ Got a script you want added? Then just fork the [GitHub repository](https://gith
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)
- 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)
@ -264,7 +231,7 @@ Check out the [page on my blog](http://bit.ly/Unity3DUIEssentials) for more deta
## [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.
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.

View File

@ -2,217 +2,225 @@
///Sourced from - http://forum.unity3d.com/threads/accordion-type-layout.271818/
using System;
using System.Collections;
using UnityEngine.UI.Extensions.Tweens;
namespace UnityEngine.UI.Extensions
{
[RequireComponent(typeof(RectTransform), typeof(LayoutElement))]
[AddComponentMenu("UI/Extensions/Accordion/Accordion Element")]
public class AccordionElement : Toggle
{
[AddComponentMenu("UI/Extensions/Accordion/Accordion Element")]
public class AccordionElement : Toggle
{
[SerializeField] private float m_MinHeight = 18f;
[SerializeField] private float m_MinHeight = 18f;
public float MinHeight => m_MinHeight;
public float MinHeight => m_MinHeight;
[SerializeField] private float m_MinWidth = 40f;
[SerializeField] private float m_MinWidth = 40f;
public float MinWidth => m_MinWidth;
public float MinWidth => m_MinWidth;
private Accordion m_Accordion;
private RectTransform m_RectTransform;
private LayoutElement m_LayoutElement;
[NonSerialized]
private readonly TweenRunner<FloatTween> m_FloatTweenRunner;
protected AccordionElement()
{
if (this.m_FloatTweenRunner == null)
this.m_FloatTweenRunner = new TweenRunner<FloatTween>();
this.m_FloatTweenRunner.Init(this);
}
protected override void Awake()
{
base.Awake();
base.transition = Transition.None;
base.toggleTransition = ToggleTransition.None;
this.m_Accordion = this.gameObject.GetComponentInParent<Accordion>();
this.m_RectTransform = this.transform as RectTransform;
this.m_LayoutElement = this.gameObject.GetComponent<LayoutElement>();
this.onValueChanged.AddListener(OnValueChanged);
}
private Accordion m_Accordion;
private RectTransform m_RectTransform;
private LayoutElement m_LayoutElement;
[NonSerialized]
private readonly TweenRunner<FloatTween> m_FloatTweenRunner;
protected AccordionElement()
{
if (this.m_FloatTweenRunner == null)
this.m_FloatTweenRunner = new TweenRunner<FloatTween>();
this.m_FloatTweenRunner.Init(this);
}
protected override void Awake()
{
base.Awake();
base.transition = Transition.None;
base.toggleTransition = ToggleTransition.None;
this.m_Accordion = this.gameObject.GetComponentInParent<Accordion>();
this.m_RectTransform = this.transform as RectTransform;
this.m_LayoutElement = this.gameObject.GetComponent<LayoutElement>();
this.onValueChanged.AddListener(OnValueChanged);
}
private new IEnumerator Start()
{
base.Start();
yield return new WaitForEndOfFrame(); // Wait for the first frame
OnValueChanged(this.isOn);
}
#if UNITY_EDITOR
protected override void OnValidate()
{
base.OnValidate();
this.m_Accordion = this.gameObject.GetComponentInParent<Accordion>();
protected override void OnValidate()
{
base.OnValidate();
this.m_Accordion = this.gameObject.GetComponentInParent<Accordion>();
if (this.group == null)
{
ToggleGroup tg = this.GetComponentInParent<ToggleGroup>();
if (tg != null)
{
this.group = tg;
}
}
LayoutElement le = this.gameObject.GetComponent<LayoutElement>();
if (this.group == null)
{
ToggleGroup tg = this.GetComponentInParent<ToggleGroup>();
if (le != null && m_Accordion != null)
{
if (this.isOn)
{
if (tg != null)
{
this.group = tg;
}
}
LayoutElement le = this.gameObject.GetComponent<LayoutElement>();
if (le != null && m_Accordion != null)
{
if (this.isOn)
{
if (m_Accordion.ExpandVerticval)
{
le.preferredHeight = -1f;
}
else
{
le.preferredWidth = -1f;
le.preferredHeight = -1f;
}
}
else
{
if (m_Accordion.ExpandVerticval)
{
le.preferredHeight = this.m_MinHeight;
}
else
{
le.preferredWidth = this.m_MinWidth;
le.preferredWidth = -1f;
}
}
else
{
if (m_Accordion.ExpandVerticval)
{
le.preferredHeight = this.m_MinHeight;
}
else
{
le.preferredWidth = this.m_MinWidth;
}
}
}
}
}
}
}
}
#endif
public void OnValueChanged(bool state)
{
if (this.m_LayoutElement == null)
return;
Accordion.Transition transition = (this.m_Accordion != null) ? this.m_Accordion.transition : Accordion.Transition.Instant;
public void OnValueChanged(bool state)
{
if (this.m_LayoutElement == null)
return;
if (transition == Accordion.Transition.Instant && m_Accordion != null)
{
if (state)
{
if (m_Accordion.ExpandVerticval)
{
this.m_LayoutElement.preferredHeight = -1f;
}
Accordion.Transition transition = (this.m_Accordion != null) ? this.m_Accordion.transition : Accordion.Transition.Instant;
if (transition == Accordion.Transition.Instant && m_Accordion != null)
{
if (state)
{
if (m_Accordion.ExpandVerticval)
{
this.m_LayoutElement.preferredHeight = -1f;
}
else
{
this.m_LayoutElement.preferredWidth = -1f;
}
}
else
{
if (m_Accordion.ExpandVerticval)
{
this.m_LayoutElement.preferredHeight = this.m_MinHeight;
}
this.m_LayoutElement.preferredWidth = -1f;
}
}
else
{
if (m_Accordion.ExpandVerticval)
{
this.m_LayoutElement.preferredHeight = this.m_MinHeight;
}
else
{
this.m_LayoutElement.preferredWidth = this.m_MinWidth;
}
}
}
else if (transition == Accordion.Transition.Tween)
{
if (state)
{
if (m_Accordion.ExpandVerticval)
{
this.StartTween(this.m_MinHeight, this.GetExpandedHeight());
}
this.m_LayoutElement.preferredWidth = this.m_MinWidth;
}
}
}
else if (transition == Accordion.Transition.Tween)
{
if (state)
{
if (m_Accordion.ExpandVerticval)
{
this.StartTween(this.m_MinHeight, this.GetExpandedHeight());
}
else
{
this.StartTween(this.m_MinWidth, this.GetExpandedWidth());
}
}
else
{
if (m_Accordion.ExpandVerticval)
{
this.StartTween(this.m_RectTransform.rect.height, this.m_MinHeight);
}
this.StartTween(this.m_MinWidth, this.GetExpandedWidth());
}
}
else
{
if (m_Accordion.ExpandVerticval)
{
this.StartTween(this.m_RectTransform.rect.height, this.m_MinHeight);
}
else
{
this.StartTween(this.m_RectTransform.rect.width, this.m_MinWidth);
}
}
}
}
protected float GetExpandedHeight()
{
if (this.m_LayoutElement == null)
return this.m_MinHeight;
float originalPrefH = this.m_LayoutElement.preferredHeight;
this.m_LayoutElement.preferredHeight = -1f;
float h = LayoutUtility.GetPreferredHeight(this.m_RectTransform);
this.m_LayoutElement.preferredHeight = originalPrefH;
return h;
}
this.StartTween(this.m_RectTransform.rect.width, this.m_MinWidth);
}
}
}
}
protected float GetExpandedWidth()
{
if (this.m_LayoutElement == null)
return this.m_MinWidth;
protected float GetExpandedHeight()
{
if (this.m_LayoutElement == null)
return this.m_MinHeight;
float originalPrefW = this.m_LayoutElement.preferredWidth;
this.m_LayoutElement.preferredWidth = -1f;
float w = LayoutUtility.GetPreferredWidth(this.m_RectTransform);
this.m_LayoutElement.preferredWidth = originalPrefW;
float originalPrefH = this.m_LayoutElement.preferredHeight;
this.m_LayoutElement.preferredHeight = -1f;
float h = LayoutUtility.GetPreferredHeight(this.m_RectTransform);
this.m_LayoutElement.preferredHeight = originalPrefH;
return w;
}
return h;
}
protected void StartTween(float startFloat, float targetFloat)
{
float duration = (this.m_Accordion != null) ? this.m_Accordion.transitionDuration : 0.3f;
FloatTween info = new FloatTween
{
duration = duration,
startFloat = startFloat,
targetFloat = targetFloat
};
if (m_Accordion.ExpandVerticval)
{
info.AddOnChangedCallback(SetHeight);
}
protected float GetExpandedWidth()
{
if (this.m_LayoutElement == null)
return this.m_MinWidth;
float originalPrefW = this.m_LayoutElement.preferredWidth;
this.m_LayoutElement.preferredWidth = -1f;
float w = LayoutUtility.GetPreferredWidth(this.m_RectTransform);
this.m_LayoutElement.preferredWidth = originalPrefW;
return w;
}
protected void StartTween(float startFloat, float targetFloat)
{
float duration = (this.m_Accordion != null) ? this.m_Accordion.transitionDuration : 0.3f;
FloatTween info = new FloatTween
{
duration = duration,
startFloat = startFloat,
targetFloat = targetFloat
};
if (m_Accordion.ExpandVerticval)
{
info.AddOnChangedCallback(SetHeight);
}
else
{
info.AddOnChangedCallback(SetWidth);
}
info.ignoreTimeScale = true;
this.m_FloatTweenRunner.StartTween(info);
}
protected void SetHeight(float height)
{
if (this.m_LayoutElement == null)
return;
this.m_LayoutElement.preferredHeight = height;
}
info.AddOnChangedCallback(SetWidth);
}
info.ignoreTimeScale = true;
this.m_FloatTweenRunner.StartTween(info);
}
protected void SetWidth(float width)
{
if (this.m_LayoutElement == null)
return;
protected void SetHeight(float height)
{
if (this.m_LayoutElement == null)
return;
this.m_LayoutElement.preferredWidth = width;
}
}
this.m_LayoutElement.preferredHeight = height;
}
protected void SetWidth(float width)
{
if (this.m_LayoutElement == null)
return;
this.m_LayoutElement.preferredWidth = width;
}
}
}

View File

@ -1,7 +1,6 @@
///Credit perchik
///Sourced from - http://forum.unity3d.com/threads/receive-onclick-event-and-pass-it-on-to-lower-ui-elements.293642/
using System;
using System.Collections.Generic;
using System.Linq;
@ -132,6 +131,9 @@ namespace UnityEngine.UI.Extensions
[System.Serializable]
public class SelectionValidityChangedEvent : Events.UnityEvent<bool> { }
[System.Serializable]
public class ItemSelectedEvent : Events.UnityEvent<string> { }
[System.Serializable]
public class ControlDisabledEvent : Events.UnityEvent<bool> { }
@ -142,6 +144,8 @@ namespace UnityEngine.UI.Extensions
public SelectionValidityChangedEvent OnSelectionValidityChanged;
// fires in both cases
public SelectionChangedEvent OnSelectionChanged;
// fires when an item is clicked
public ItemSelectedEvent OnItemSelected;
// fires when item is changed;
public ControlDisabledEvent OnControlDisabled;
@ -359,10 +363,10 @@ namespace UnityEngine.UI.Extensions
/// <param name="item"></param>
private void OnItemClicked(string item)
{
//Debug.Log("item " + item + " clicked");
Text = item;
_mainInput.text = Text;
ToggleDropdownPanel(true);
OnItemSelected?.Invoke(Text);
}
private void RedrawPanel()

View File

@ -1,29 +1,30 @@
///Credit perchik
///Sourced from - http://forum.unity3d.com/threads/receive-onclick-event-and-pass-it-on-to-lower-ui-elements.293642/
using System;
using System.Collections.Generic;
namespace UnityEngine.UI.Extensions
{
/// <summary>
/// Extension to the UI class which creates a dropdown list
/// </summary>
[RequireComponent(typeof(RectTransform))]
/// <summary>
/// Extension to the UI class which creates a dropdown list
/// </summary>
[RequireComponent(typeof(RectTransform))]
[AddComponentMenu("UI/Extensions/ComboBox/Dropdown List")]
public class DropDownList : MonoBehaviour
{
public Color disabledTextColor;
public DropDownListItem SelectedItem { get; private set; } //outside world gets to get this, not set it
[Header("Dropdown List Items")]
public List<DropDownListItem> Items;
[Header("Dropdown List Items")]
public List<DropDownListItem> Items;
[Header("Properties")]
[Header("Properties")]
[SerializeField]
private bool isActive = true;
[SerializeField]
private bool isActive = true;
public bool OverrideHighlighted = true;
public bool OverrideHighlighted = true;
//private bool isInitialized = false;
private bool _isPanelActive = false;
@ -46,10 +47,13 @@ namespace UnityEngine.UI.Extensions
private List<DropDownListButton> _panelItems = new List<DropDownListButton>();
private GameObject _itemTemplate;
private GameObject _itemTemplate;
private bool _initialized;
[SerializeField]
private string _defaultMainButtonCaption = null;
private Color _defaultNormalColor;
[SerializeField]
private float _scrollBarWidth = 20.0f;
public float ScrollBarWidth
{
@ -61,7 +65,6 @@ namespace UnityEngine.UI.Extensions
}
}
// private int scrollOffset; //offset of the selected item
private int _selectedIndex = -1;
[SerializeField]
@ -76,42 +79,42 @@ namespace UnityEngine.UI.Extensions
}
}
[SerializeField]
private float dropdownOffset;
[SerializeField]
private float dropdownOffset;
[SerializeField]
private bool _displayPanelAbove = false;
[SerializeField]
private bool _displayPanelAbove = false;
public bool SelectFirstItemOnStart = false;
public bool SelectFirstItemOnStart = false;
[SerializeField]
private int selectItemIndexOnStart = 0;
private bool shouldSelectItemOnStart => SelectFirstItemOnStart || selectItemIndexOnStart > 0;
[SerializeField]
private int selectItemIndexOnStart = 0;
private bool shouldSelectItemOnStart => SelectFirstItemOnStart || selectItemIndexOnStart > 0;
[System.Serializable]
[System.Serializable]
public class SelectionChangedEvent : Events.UnityEvent<int> { }
// fires when item is changed;
[Header("Events")]
public SelectionChangedEvent OnSelectionChanged;
// fires when item is changed;
[Header("Events")]
public SelectionChangedEvent OnSelectionChanged;
[System.Serializable]
public class ControlDisabledEvent : Events.UnityEvent<bool> { }
[System.Serializable]
public class ControlDisabledEvent : Events.UnityEvent<bool> { }
// fires when item is changed;
public ControlDisabledEvent OnControlDisabled;
// fires when item changes between enabled and disabled;
public ControlDisabledEvent OnControlDisabled;
public void Start()
{
Initialize();
if (shouldSelectItemOnStart && Items.Count > 0)
{
SelectItemIndex(SelectFirstItemOnStart ? 0 : selectItemIndexOnStart);
}
RedrawPanel();
}
public void Start()
{
Initialize();
if (shouldSelectItemOnStart && Items.Count > 0)
{
SelectItemIndex(SelectFirstItemOnStart ? 0 : selectItemIndexOnStart);
}
RedrawPanel();
}
private bool Initialize()
private bool Initialize()
{
if (_initialized) return true;
@ -121,6 +124,9 @@ namespace UnityEngine.UI.Extensions
_rectTransform = GetComponent<RectTransform>();
_mainButton = new DropDownListButton(_rectTransform.Find("MainButton").gameObject);
_defaultMainButtonCaption = _mainButton.txt.text;
_defaultNormalColor = _mainButton.btn.colors.normalColor;
_overlayRT = _rectTransform.Find("Overlay").GetComponent<RectTransform>();
_overlayRT.gameObject.SetActive(false);
_scrollPanelRT = _overlayRT.Find("ScrollPanel").GetComponent<RectTransform>();
@ -147,32 +153,32 @@ namespace UnityEngine.UI.Extensions
Debug.LogError("Something is setup incorrectly with the dropdownlist component causing a Null Reference Exception");
success = false;
}
_initialized = true;
_initialized = true;
RebuildPanel();
RebuildPanel();
RedrawPanel();
return success;
}
/// <summary>
/// <summary>
/// Update the drop down selection to a specific index
/// </summary>
/// <param name="index"></param>
public void SelectItemIndex(int index)
{
ToggleDropdownPanel(false);
OnItemClicked(index);
}
{
ToggleDropdownPanel();
OnItemClicked(index);
}
// currently just using items in the list instead of being able to add to it.
/// <summary>
/// Rebuilds the list from a new collection.
/// </summary>
/// <remarks>
/// NOTE, this will clear all existing items
/// </remarks>
/// <param name="list"></param>
public void RefreshItems(params object[] list)
// currently just using items in the list instead of being able to add to it.
/// <summary>
/// Rebuilds the list from a new collection.
/// </summary>
/// <remarks>
/// NOTE, this will clear all existing items
/// </remarks>
/// <param name="list"></param>
public void RefreshItems(params object[] list)
{
Items.Clear();
List<DropDownListItem> ddItems = new List<DropDownListItem>();
@ -197,76 +203,94 @@ namespace UnityEngine.UI.Extensions
}
Items.AddRange(ddItems);
RebuildPanel();
RedrawPanel();
}
RedrawPanel();
}
/// <summary>
/// Adds an additional item to the drop down list (recommended)
/// </summary>
/// <param name="item">Item of type DropDownListItem</param>
public void AddItem(DropDownListItem item)
{
/// <summary>
/// Adds an additional item to the drop down list (recommended)
/// </summary>
/// <param name="item">Item of type DropDownListItem</param>
public void AddItem(DropDownListItem item)
{
Items.Add(item);
RebuildPanel();
RedrawPanel();
}
}
/// <summary>
/// Adds an additional drop down list item using a string name
/// </summary>
/// <param name="item">Item of type String</param>
public void AddItem(string item)
/// <summary>
/// Adds an additional drop down list item using a string name
/// </summary>
/// <param name="item">Item of type String</param>
public void AddItem(string item)
{
Items.Add(new DropDownListItem(caption: (string)item));
RebuildPanel();
RedrawPanel();
}
RedrawPanel();
}
/// <summary>
/// Adds an additional drop down list item using a sprite image
/// </summary>
/// <param name="item">Item of type UI Sprite</param>
public void AddItem(Sprite item)
/// <summary>
/// Adds an additional drop down list item using a sprite image
/// </summary>
/// <param name="item">Item of type UI Sprite</param>
public void AddItem(Sprite item)
{
Items.Add(new DropDownListItem(image: (Sprite)item));
RebuildPanel();
RedrawPanel();
}
RedrawPanel();
}
/// <summary>
/// Removes an item from the drop down list (recommended)
/// </summary>
/// <param name="item">Item of type DropDownListItem</param>
public void RemoveItem(DropDownListItem item)
/// <summary>
/// Removes an item from the drop down list (recommended)
/// </summary>
/// <param name="item">Item of type DropDownListItem</param>
public void RemoveItem(DropDownListItem item)
{
Items.Remove(item);
RebuildPanel();
RedrawPanel();
}
RedrawPanel();
}
/// <summary>
/// Removes an item from the drop down list item using a string name
/// </summary>
/// <param name="item">Item of type String</param>
public void RemoveItem(string item)
/// <summary>
/// Removes an item from the drop down list item using a string name
/// </summary>
/// <param name="item">Item of type String</param>
public void RemoveItem(string item)
{
Items.Remove(new DropDownListItem(caption: (string)item));
RebuildPanel();
RedrawPanel();
}
RedrawPanel();
}
/// <summary>
/// Removes an item from the drop down list item using a sprite image
/// </summary>
/// <param name="item">Item of type UI Sprite</param>
public void RemoveItem(Sprite item)
/// <summary>
/// Removes an item from the drop down list item using a sprite image
/// </summary>
/// <param name="item">Item of type UI Sprite</param>
public void RemoveItem(Sprite item)
{
Items.Remove(new DropDownListItem(image: (Sprite)item));
RebuildPanel();
RedrawPanel();
}
RedrawPanel();
}
public void ResetItems()
public void ResetDropDown()
{
if (!_initialized)
{
return;
}
_mainButton.txt.text = _defaultMainButtonCaption;
for (int i = 0; i < _itemsPanelRT.childCount; i++)
{
_panelItems[i].btnImg.color = _defaultNormalColor;
}
_selectedIndex = -1;
_initialized = false;
Initialize();
}
public void ResetItems()
{
Items.Clear();
RebuildPanel();
@ -304,7 +328,7 @@ namespace UnityEngine.UI.Extensions
_panelItems[i].txt.text = item.Caption;
if (item.IsDisabled) _panelItems[i].txt.color = disabledTextColor;
if (_panelItems[i].btnImg != null) _panelItems[i].btnImg.sprite = null;//hide the button image
if (_panelItems[i].btnImg != null) _panelItems[i].btnImg.sprite = null;//hide the button image
_panelItems[i].img.sprite = item.Image;
_panelItems[i].img.color = (item.Image == null) ? new Color(1, 1, 1, 0)
: item.IsDisabled ? new Color(1, 1, 1, .5f)
@ -327,7 +351,7 @@ namespace UnityEngine.UI.Extensions
if (indx != _selectedIndex && OnSelectionChanged != null) OnSelectionChanged.Invoke(indx);
_selectedIndex = indx;
ToggleDropdownPanel(true);
ToggleDropdownPanel();
UpdateSelected();
}
@ -349,25 +373,25 @@ namespace UnityEngine.UI.Extensions
_mainButton.txt.text = SelectedItem.Caption;
//update selected index color
if (OverrideHighlighted)
{
for (int i = 0; i < _itemsPanelRT.childCount; i++)
{
_panelItems[i].btnImg.color = (_selectedIndex == i) ? _mainButton.btn.colors.highlightedColor : new Color(0, 0, 0, 0);
}
}
}
//update selected index color
if (OverrideHighlighted)
{
for (int i = 0; i < _itemsPanelRT.childCount; i++)
{
_panelItems[i].btnImg.color = (_selectedIndex == i) ? _mainButton.btn.colors.highlightedColor : new Color(0, 0, 0, 0);
}
}
}
private void RedrawPanel()
{
float scrollbarWidth = _panelItems.Count > ItemsToDisplay ? _scrollBarWidth : 0f;//hide the scrollbar if there's not enough items
_scrollBarRT.gameObject.SetActive(_panelItems.Count > ItemsToDisplay);
float dropdownHeight = _itemsToDisplay > 0 ? _rectTransform.sizeDelta.y * Mathf.Min(_itemsToDisplay, _panelItems.Count) : _rectTransform.sizeDelta.y * _panelItems.Count;
dropdownHeight += dropdownOffset;
float dropdownHeight = _itemsToDisplay > 0 ? _rectTransform.sizeDelta.y * Mathf.Min(_itemsToDisplay, _panelItems.Count) : _rectTransform.sizeDelta.y * _panelItems.Count;
dropdownHeight += dropdownOffset;
if (!_hasDrawnOnce || _rectTransform.sizeDelta != _mainButton.rectTransform.sizeDelta)
if (!_hasDrawnOnce || _rectTransform.sizeDelta != _mainButton.rectTransform.sizeDelta)
{
_hasDrawnOnce = true;
_mainButton.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, _rectTransform.sizeDelta.x);
@ -377,12 +401,12 @@ namespace UnityEngine.UI.Extensions
itemsRemaining = itemsRemaining < 0 ? 0 : itemsRemaining;
_scrollPanelRT.SetParent(transform, true);
_scrollPanelRT.anchoredPosition = _displayPanelAbove ?
new Vector2(0, dropdownOffset + dropdownHeight) :
new Vector2(0, -(dropdownOffset + _rectTransform.sizeDelta.y));
_scrollPanelRT.anchoredPosition = _displayPanelAbove ?
new Vector2(0, dropdownOffset + dropdownHeight) :
new Vector2(0, -(dropdownOffset + _rectTransform.sizeDelta.y));
//make the overlay fill the screen
_overlayRT.SetParent(_canvas.transform, false);
//make the overlay fill the screen
_overlayRT.SetParent(_canvas.transform, false);
_overlayRT.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, _canvasRT.sizeDelta.x);
_overlayRT.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, _canvasRT.sizeDelta.y);
@ -392,7 +416,7 @@ namespace UnityEngine.UI.Extensions
if (_panelItems.Count < 1) return;
_scrollPanelRT.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight);
_scrollPanelRT.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight);
_scrollPanelRT.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, _rectTransform.sizeDelta.x);
_itemsPanelRT.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, _scrollPanelRT.sizeDelta.x - scrollbarWidth - 5);
@ -407,38 +431,63 @@ namespace UnityEngine.UI.Extensions
}
/// <summary>
/// Toggle the drop down list
/// Toggle the drop down list if it is active
/// </summary>
/// <param name="directClick"> whether an item was directly clicked on</param>
public void ToggleDropdownPanel(bool directClick)
/// <param name="directClick">Retained for backwards compatibility only.</param>
[Obsolete("DirectClick Parameter is no longer required")]
public void ToggleDropdownPanel(bool directClick = false)
{
if (!isActive) return;
ToggleDropdownPanel();
}
/// <summary>
/// Toggle the drop down list if it is active
/// </summary>
public void ToggleDropdownPanel()
{
if (!isActive)
{
return;
}
_overlayRT.transform.localScale = new Vector3(1, 1, 1);
_scrollBarRT.transform.localScale = new Vector3(1, 1, 1);
_isPanelActive = !_isPanelActive;
_overlayRT.gameObject.SetActive(_isPanelActive);
if (_isPanelActive)
{
transform.SetAsLastSibling();
}
else if (directClick)
{
// scrollOffset = Mathf.RoundToInt(itemsPanelRT.anchoredPosition.y / _rectTransform.sizeDelta.y);
}
}
/// <summary>
/// Updates the control and sets its active status, determines whether the dropdown will open ot not
/// </summary>
/// <param name="status"></param>
public void SetActive(bool status)
{
if (status != isActive)
{
OnControlDisabled?.Invoke(status);
}
isActive = status;
}
}
/// <summary>
/// Hides the drop down panel if its visible at the moment
/// </summary>
public void HideDropDownPanel()
{
if (!_isPanelActive)
{
return;
}
ToggleDropdownPanel();
}
/// <summary>
/// Updates the control and sets its active status, determines whether the dropdown will open ot not
/// and takes care of the underlying button to follow the status.
/// </summary>
/// <param name="status"></param>
public void SetActive(bool status)
{
if (status == isActive)
{
return;
}
isActive = status;
OnControlDisabled?.Invoke(isActive);
_mainButton.btn.enabled = isActive;
}
}
}

View File

@ -13,7 +13,11 @@ namespace UnityEngine.UI.Extensions
void Awake()
{
#if UNITY_2023_1_OR_NEWER
foreach (var list in FindObjectsByType<ReorderableList>(FindObjectsSortMode.None))
#else
foreach (var list in FindObjectsOfType<ReorderableList>())
#endif
{
list.OnElementDropped.AddListener(ElementDropped);
}

View File

@ -169,7 +169,11 @@ namespace UnityEngine.UI.Extensions
// If we do not have a group of selectables already set, we'll just loop through every object that's a monobehaviour, and look for selectable interfaces in them
if (selectableGroup == null) {
#if UNITY_2023_1_OR_NEWER
behavioursToGetSelectionsFrom = GameObject.FindObjectsByType<MonoBehaviour>(FindObjectsSortMode.None);
#else
behavioursToGetSelectionsFrom = GameObject.FindObjectsOfType<MonoBehaviour>();
#endif
} else {
behavioursToGetSelectionsFrom = selectableGroup;
}

View File

@ -367,5 +367,14 @@ namespace UnityEngine.UI.Extensions
eventData.useDragThreshold = false;
}
public void SetXWithoutNotify(float x)
{
SetX(x, false);
}
public void SetYWithoutNotify(float y)
{
SetY(y, false);
}
}
}

View File

@ -2,10 +2,19 @@
/// Sourced from - http://forum.unity3d.com/members/melang.593409/
/// NOT supported in Unity 2022
using System;
#if !UNITY_2022_1_OR_NEWER
using System.Collections.Generic;
#endif
namespace UnityEngine.UI.Extensions
{
#if UNITY_2022_1_OR_NEWER
[Obsolete("BestFitOutline is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
public class BestFitOutline : Shadow
{
}
#else
[AddComponentMenu("UI/Effects/Extensions/BestFit Outline")]
public class BestFitOutline : Shadow
{
@ -61,5 +70,5 @@ namespace UnityEngine.UI.Extensions
}
}
}
}
#endif
#endif
}

View File

@ -1,13 +1,18 @@
/// Credit Breyer
/// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/#post-1777407

using System;
namespace UnityEngine.UI.Extensions
{
#if UNITY_2022_1_OR_NEWER
[RequireComponent(typeof(TMPro.TMP_Text))]
[Obsolete("CurvedText is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
public class CurvedText : BaseMeshEffect
{
public override void ModifyMesh(VertexHelper vh)
{
}
}
#else
[RequireComponent(typeof(Text))]
#endif
[RequireComponent(typeof(RectTransform))]
[AddComponentMenu("UI/Effects/Extensions/Curved Text")]
public class CurvedText : BaseMeshEffect
@ -86,4 +91,5 @@ namespace UnityEngine.UI.Extensions
}
}
}
}
#endif
}

View File

@ -1,14 +1,21 @@
/// adaption for cylindrical bending by herbst

using System;
/// adaption for cylindrical bending by herbst
/// Credit Breyer
/// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/#post-1777407
namespace UnityEngine.UI.Extensions
{
#if UNITY_2022_1_OR_NEWER
[RequireComponent(typeof(TMPro.TMP_Text))]
[Obsolete("CylinderText is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
public class CylinderText : BaseMeshEffect
{
public override void ModifyMesh(VertexHelper vh)
{
}
}
#else
[RequireComponent(typeof(Text))]
#endif
[RequireComponent(typeof(RectTransform))]
[AddComponentMenu("UI/Effects/Extensions/Cylinder Text")]
public class CylinderText : BaseMeshEffect
@ -56,4 +63,5 @@ namespace UnityEngine.UI.Extensions
}
}
}
}
#endif
}

View File

@ -1,6 +1,4 @@
/// Credit Deeperbeige
/// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
/*
/*
Produces an simple tracking/letter-spacing effect on UI Text components.
@ -40,11 +38,25 @@ use HTML-like tags in your text. Try it out, you'll see what I mean. It doesn't
break down entirely, but it doesn't really do what you'd want either.
*/
#if !UNITY_2022_1_OR_NEWER
using System.Collections.Generic;
#endif
using System;
/// Credit Deeperbeige
/// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
namespace UnityEngine.UI.Extensions
{
#if UNITY_2022_1_OR_NEWER
[Obsolete("LetterSpacing is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
public class LetterSpacing : BaseMeshEffect
{
public override void ModifyMesh(VertexHelper vh)
{
}
}
#else
[AddComponentMenu("UI/Effects/Extensions/Letter Spacing")]
///Summary
/// Note, Vertex Count has changed in 5.2.1+, is now 6 (two tris) instead of 4 (tri strip).
@ -55,13 +67,13 @@ namespace UnityEngine.UI.Extensions
protected LetterSpacing() { }
#if UNITY_EDITOR
#if UNITY_EDITOR
protected override void OnValidate()
{
spacing = m_spacing;
base.OnValidate();
}
#endif
#endif
public float spacing
{
@ -74,6 +86,11 @@ namespace UnityEngine.UI.Extensions
}
}
protected override void Awake()
{
Debug.Log($"Awake, [{m_spacing}]");
}
public override void ModifyMesh(VertexHelper vh)
{
if (! IsActive()) return;
@ -81,11 +98,8 @@ namespace UnityEngine.UI.Extensions
List<UIVertex> verts = new List<UIVertex>();
vh.GetUIVertexStream(verts);
#if UNITY_2022_1_OR_NEWER
var text = GetComponent<TMPro.TMP_Text>();
#else
var text = GetComponent<Text>();
#endif
if (text == null)
{
Debug.LogWarning("LetterSpacing: Missing Text component");
@ -98,28 +112,6 @@ namespace UnityEngine.UI.Extensions
float alignmentFactor = 0;
int glyphIdx = 0;
#if UNITY_2022_1_OR_NEWER
switch (text.alignment)
{
case TMPro.TextAlignmentOptions.BottomLeft:
case TMPro.TextAlignmentOptions.MidlineLeft:
case TMPro.TextAlignmentOptions.TopLeft:
alignmentFactor = 0f;
break;
case TMPro.TextAlignmentOptions.BottomJustified:
case TMPro.TextAlignmentOptions.MidlineJustified:
case TMPro.TextAlignmentOptions.TopJustified:
alignmentFactor = 0.5f;
break;
case TMPro.TextAlignmentOptions.BottomRight:
case TMPro.TextAlignmentOptions.MidlineRight:
case TMPro.TextAlignmentOptions.TopRight:
alignmentFactor = 1f;
break;
}
#else
switch (text.alignment)
{
case TextAnchor.LowerLeft:
@ -140,8 +132,7 @@ namespace UnityEngine.UI.Extensions
alignmentFactor = 1f;
break;
}
#endif
for (int lineIdx=0; lineIdx < lines.Length; lineIdx++)
{
string line = lines[lineIdx];
@ -192,4 +183,5 @@ namespace UnityEngine.UI.Extensions
vh.AddUIVertexTriangleStream(verts);
}
}
}
#endif
}

View File

@ -1,5 +1,3 @@
/// Credit herbst / derived from LetterSpacing by Deeperbeige
/// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
/*
Produces an simple mono-spacing effect on UI Text components.
@ -40,17 +38,27 @@ use HTML-like tags in your text. Try it out, you'll see what I mean. It doesn't
break down entirely, but it doesn't really do what you'd want either.
*/
#if !UNITY_2022_1_OR_NEWER
using System.Collections.Generic;
#endif
using System;
/// Credit herbst / derived from LetterSpacing by Deeperbeige
/// Sourced from - http://forum.unity3d.com/threads/adjustable-character-spacing-free-script.288277/
namespace UnityEngine.UI.Extensions
{
[AddComponentMenu("UI/Effects/Extensions/Mono Spacing")]
#if UNITY_2022_1_OR_NEWER
[RequireComponent(typeof(TMPro.TMP_Text))]
[Obsolete("MonoSpacing is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
public class MonoSpacing : BaseMeshEffect
{
public override void ModifyMesh(VertexHelper vh)
{
}
}
#else
[AddComponentMenu("UI/Effects/Extensions/Mono Spacing")]
[RequireComponent(typeof(Text))]
#endif
[RequireComponent(typeof(RectTransform))]
///Summary
/// Note, Vertex Count has changed in 5.2.1+, is now 6 (two tris) instead of 4 (tri strip).
@ -62,21 +70,15 @@ namespace UnityEngine.UI.Extensions
public bool UseHalfCharWidth = false;
private RectTransform rectTransform;
#if UNITY_2022_1_OR_NEWER
private TMPro.TMP_Text text;
#else
private Text text;
#endif
protected MonoSpacing() { }
protected override void Awake()
{
#if UNITY_2022_1_OR_NEWER
text = GetComponent<TMPro.TMP_Text>();
#else
text = GetComponent<Text>();
#endif
if (text == null)
{
Debug.LogWarning("MonoSpacing: Missing Text component");
@ -85,13 +87,13 @@ namespace UnityEngine.UI.Extensions
rectTransform = text.GetComponent<RectTransform>();
}
#if UNITY_EDITOR
#if UNITY_EDITOR
protected override void OnValidate()
{
Spacing = m_spacing;
base.OnValidate();
}
#endif
#endif
public float Spacing
{
@ -117,28 +119,6 @@ namespace UnityEngine.UI.Extensions
float alignmentFactor = 0;
int glyphIdx = 0;
#if UNITY_2022_1_OR_NEWER
switch (text.alignment)
{
case TMPro.TextAlignmentOptions.BottomLeft:
case TMPro.TextAlignmentOptions.MidlineLeft:
case TMPro.TextAlignmentOptions.TopLeft:
alignmentFactor = 0f;
break;
case TMPro.TextAlignmentOptions.BottomJustified:
case TMPro.TextAlignmentOptions.MidlineJustified:
case TMPro.TextAlignmentOptions.TopJustified:
alignmentFactor = 0.5f;
break;
case TMPro.TextAlignmentOptions.BottomRight:
case TMPro.TextAlignmentOptions.MidlineRight:
case TMPro.TextAlignmentOptions.TopRight:
alignmentFactor = 1f;
break;
}
#else
switch (text.alignment)
{
case TextAnchor.LowerLeft:
@ -159,7 +139,7 @@ namespace UnityEngine.UI.Extensions
alignmentFactor = 1f;
break;
}
#endif
for (int lineIdx=0; lineIdx < lines.Length; lineIdx++)
{
string line = lines[lineIdx];
@ -221,4 +201,5 @@ namespace UnityEngine.UI.Extensions
vh.AddUIVertexTriangleStream(verts);
}
}
}
#endif
}

View File

@ -1,12 +1,25 @@
#if !UNITY_2022_1_OR_NEWER
using System.Collections.Generic;
#endif
using System;
/// Credit Melang, Lee Hui
/// Sourced from - http://forum.unity3d.com/members/melang.593409/
/// GC Alloc fix - https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/pull-requests/130
/// NOT supported in Unity 2022
#if !UNITY_2022_1_OR_NEWER
using System.Collections.Generic;
namespace UnityEngine.UI.Extensions
{
#if UNITY_2022_1_OR_NEWER
[Obsolete("BestFitOutline is not supported in Unity 2022.1 or newer. Use TMPro instead.")]
public class NicerOutline : BaseMeshEffect
{
public override void ModifyMesh(VertexHelper vh)
{
}
}
#else
//An outline that looks a bit nicer than the default one. It has less "holes" in the outline by drawing more copies of the effect
[AddComponentMenu("UI/Effects/Extensions/Nicer Outline")]
public class NicerOutline : BaseMeshEffect
@ -134,7 +147,7 @@ namespace UnityEngine.UI.Extensions
start += ApplyText(m_Verts, vh, start);
}
private int ApplyOutlineNoGC(List<UIVertex> verts, Color color, float x, float y, VertexHelper vh, int startIndex)
private int ApplyOutlineNoGC(List<UIVertex> verts, Color32 color, float x, float y, VertexHelper vh, int startIndex)
{
int length = verts.Count;
for (int i = 0; i < length; ++i)
@ -194,5 +207,5 @@ namespace UnityEngine.UI.Extensions
}
#endif
}
}
#endif
#endif
}

View File

@ -16,6 +16,9 @@ namespace UnityEngine.UI.Extensions
[Tooltip("Enables 3d rotation for the particles")]
public bool use3dRotation = false;
[Tooltip("Enables using Renderer.lengthScale parameter")]
public bool _useLengthScale = false;
private Transform _transform;
private ParticleSystem pSystem;
private ParticleSystem.Particle[] particles;
@ -91,7 +94,7 @@ namespace UnityEngine.UI.Extensions
pRenderer = pSystem.GetComponent<ParticleSystemRenderer>();
if (pRenderer != null)
pRenderer.enabled = false;
if (material == null)
{
var foundShader = ShaderLibrary.GetShaderInstance("UI Extensions/Particles/Additive");
@ -183,8 +186,6 @@ namespace UnityEngine.UI.Extensions
#else
Vector2 position = (pSystem.simulationSpace == ParticleSystemSimulationSpace.Local ? particle.position : _transform.InverseTransformPoint(particle.position));
#endif
float rotation = -particle.rotation * Mathf.Deg2Rad;
float rotation90 = rotation + Mathf.PI / 2;
Color32 color = particle.GetCurrentColor(pSystem);
float size = particle.GetCurrentSize(pSystem) * 0.5f;
@ -280,13 +281,29 @@ namespace UnityEngine.UI.Extensions
_quad[3].color = color;
_quad[3].uv0 = temp;
float rotation = -particle.rotation * Mathf.Deg2Rad;
var lengthScale = pRenderer.lengthScale;
if (_useLengthScale)
{
// rotate towards velocity
var normalizedVelocity = particle.velocity.normalized;
rotation = Mathf.Atan2(normalizedVelocity.y, normalizedVelocity.x);
}
else
{
lengthScale = 1f;
}
float rotation90 = rotation + Mathf.PI / 2;
if (rotation == 0)
{
// no rotation
corner1.x = position.x - size;
corner1.y = position.y - size;
corner1.y = position.y - size * lengthScale;
corner2.x = position.x + size;
corner2.y = position.y + size;
corner2.y = position.y + size * lengthScale;
temp.x = corner1.x;
temp.y = corner1.y;
@ -339,7 +356,7 @@ namespace UnityEngine.UI.Extensions
else
{
// apply rotation
Vector2 right = new Vector2(Mathf.Cos(rotation), Mathf.Sin(rotation)) * size;
Vector2 right = new Vector2(Mathf.Cos(rotation), Mathf.Sin(rotation)) * size * lengthScale;
Vector2 up = new Vector2(Mathf.Cos(rotation90), Mathf.Sin(rotation90)) * size;
_quad[0].position = position - right - up;

View File

@ -6,6 +6,7 @@
/// Vertical Flow by Ramon Molossi
using System.Collections.Generic;
using System.Text;
namespace UnityEngine.UI.Extensions
{
@ -17,27 +18,32 @@ namespace UnityEngine.UI.Extensions
{
public enum Axis { Horizontal = 0, Vertical = 1 }
public float SpacingX = 0f;
private float _layoutHeight;
private float _layoutWidth;
public float SpacingX = 0f;
public float SpacingY = 0f;
public bool ExpandHorizontalSpacing = false;
public bool ChildForceExpandWidth = false;
public bool ChildForceExpandHeight = false;
public bool invertOrder = false;
private float _layoutHeight;
private float _layoutWidth;
[SerializeField] protected Axis m_StartAxis = Axis.Horizontal;
public Axis startAxis { get { return m_StartAxis; } set { SetProperty(ref m_StartAxis, value); } }
[SerializeField]
protected Axis m_StartAxis = Axis.Horizontal;
public Axis StartAxis { get { return m_StartAxis; } set { SetProperty(ref m_StartAxis, value); } }
public override void CalculateLayoutInputHorizontal()
{
if (startAxis == Axis.Horizontal) {
base.CalculateLayoutInputHorizontal ();
var minWidth = GetGreatestMinimumChildWidth () + padding.left + padding.right;
SetLayoutInputForAxis (minWidth, -1, -1, 0);
} else {
_layoutWidth = SetLayout (0, true);
if (StartAxis == Axis.Horizontal)
{
base.CalculateLayoutInputHorizontal();
var minWidth = GetGreatestMinimumChildWidth() + padding.left + padding.right;
SetLayoutInputForAxis(minWidth, -1, -1, 0);
}
else
{
_layoutWidth = SetLayout(0, true);
}
}
@ -54,55 +60,42 @@ namespace UnityEngine.UI.Extensions
public override void CalculateLayoutInputVertical()
{
if (startAxis == Axis.Horizontal) {
_layoutHeight = SetLayout (1, true);
} else {
base.CalculateLayoutInputHorizontal ();
var minHeight = GetGreatestMinimumChildHeigth () + padding.bottom + padding.top;
SetLayoutInputForAxis (minHeight, -1, -1, 1);
if (StartAxis == Axis.Horizontal)
{
_layoutHeight = SetLayout(1, true);
}
else
{
base.CalculateLayoutInputHorizontal();
var minHeight = GetGreatestMinimumChildHeigth() + padding.bottom + padding.top;
SetLayoutInputForAxis(minHeight, -1, -1, 1);
}
}
protected bool IsCenterAlign
{
get
{
return childAlignment == TextAnchor.LowerCenter || childAlignment == TextAnchor.MiddleCenter ||
childAlignment == TextAnchor.UpperCenter;
}
get => childAlignment == TextAnchor.LowerCenter || childAlignment == TextAnchor.MiddleCenter || childAlignment == TextAnchor.UpperCenter;
}
protected bool IsRightAlign
{
get
{
return childAlignment == TextAnchor.LowerRight || childAlignment == TextAnchor.MiddleRight ||
childAlignment == TextAnchor.UpperRight;
}
get => childAlignment == TextAnchor.LowerRight || childAlignment == TextAnchor.MiddleRight || childAlignment == TextAnchor.UpperRight;
}
protected bool IsMiddleAlign
{
get
{
return childAlignment == TextAnchor.MiddleLeft || childAlignment == TextAnchor.MiddleRight ||
childAlignment == TextAnchor.MiddleCenter;
}
get => childAlignment == TextAnchor.MiddleLeft || childAlignment == TextAnchor.MiddleRight || childAlignment == TextAnchor.MiddleCenter;
}
protected bool IsLowerAlign
{
get
{
return childAlignment == TextAnchor.LowerLeft || childAlignment == TextAnchor.LowerRight ||
childAlignment == TextAnchor.LowerCenter;
}
get => childAlignment == TextAnchor.LowerLeft || childAlignment == TextAnchor.LowerRight || childAlignment == TextAnchor.LowerCenter;
}
/// <summary>
/// Holds the rects that will make up the current bar being processed
/// </summary>
private readonly IList<RectTransform> _itemList = new List<RectTransform>();
private readonly IList<RectTransform> _itemList = new List<RectTransform>();
/// <summary>
/// Main layout method
@ -122,25 +115,34 @@ namespace UnityEngine.UI.Extensions
float counterOffset = 0;
float groupSize = 0;
float workingSize = 0;
if (startAxis == Axis.Horizontal) {
if (StartAxis == Axis.Horizontal)
{
groupSize = groupHeight;
workingSize = groupWidth - padding.left - padding.right;
if (IsLowerAlign) {
if (IsLowerAlign)
{
offset = (float)padding.bottom;
counterOffset = (float)padding.top;
} else {
}
else
{
offset = (float)padding.top;
counterOffset = (float)padding.bottom;
}
spacingBetweenBars = SpacingY;
spacingBetweenElements = SpacingX;
} else if (startAxis == Axis.Vertical) {
}
else if (StartAxis == Axis.Vertical)
{
groupSize = groupWidth;
workingSize = groupHeight - padding.top - padding.bottom;
if (IsRightAlign) {
if (IsRightAlign)
{
offset = (float)padding.right;
counterOffset = (float)padding.left;
} else {
}
else
{
offset = (float)padding.left;
counterOffset = (float)padding.right;
}
@ -151,50 +153,59 @@ namespace UnityEngine.UI.Extensions
var currentBarSize = 0f;
var currentBarSpace = 0f;
for (var i = 0; i < rectChildren.Count; i++) {
for (var i = 0; i < rectChildren.Count; i++)
{
int index = i;
var child = rectChildren [index];
var child = rectChildren[index];
float childSize = 0;
float childOtherSize = 0;
//get height and width of elements.
if (startAxis == Axis.Horizontal) {
if (invertOrder) {
index = IsLowerAlign ? rectChildren.Count - 1 - i : i;
if (StartAxis == Axis.Horizontal)
{
if (invertOrder)
{
index = IsLowerAlign ? rectChildren.Count - 1 - i : i;
}
child = rectChildren [index];
childSize = LayoutUtility.GetPreferredSize (child, 0);
childSize = Mathf.Min (childSize, workingSize);
childOtherSize = LayoutUtility.GetPreferredSize (child, 1);
} else if (startAxis == Axis.Vertical) {
if (invertOrder) {
child = rectChildren[index];
childSize = LayoutUtility.GetPreferredSize(child, 0);
childSize = Mathf.Min(childSize, workingSize);
childOtherSize = LayoutUtility.GetPreferredSize(child, 1);
}
else if (StartAxis == Axis.Vertical)
{
if (invertOrder)
{
index = IsRightAlign ? rectChildren.Count - 1 - i : i;
}
child = rectChildren [index];
childSize = LayoutUtility.GetPreferredSize (child, 1);
childSize = Mathf.Min (childSize, workingSize);
childOtherSize = LayoutUtility.GetPreferredSize (child, 0);
child = rectChildren[index];
childSize = LayoutUtility.GetPreferredSize(child, 1);
childSize = Mathf.Min(childSize, workingSize);
childOtherSize = LayoutUtility.GetPreferredSize(child, 0);
}
// If adding this element would exceed the bounds of the container,
// go to a new bar after processing the current bar
if (currentBarSize + childSize > workingSize) {
if (currentBarSize + childSize > workingSize)
{
currentBarSize -= spacingBetweenElements;
// Process current bar elements positioning
if (!layoutInput) {
if (startAxis == Axis.Horizontal) {
float newOffset = CalculateRowVerticalOffset (groupSize, offset, currentBarSpace);
LayoutRow (_itemList, currentBarSize, currentBarSpace, workingSize, padding.left, newOffset, axis);
} else if (startAxis == Axis.Vertical) {
float newOffset = CalculateColHorizontalOffset (groupSize, offset, currentBarSpace);
LayoutCol (_itemList, currentBarSpace, currentBarSize, workingSize, newOffset, padding.top, axis);
if (!layoutInput)
{
if (StartAxis == Axis.Horizontal)
{
float newOffset = CalculateRowVerticalOffset(groupSize, offset, currentBarSpace);
LayoutRow(_itemList, currentBarSize, currentBarSpace, workingSize, padding.left, newOffset, axis);
}
else if (StartAxis == Axis.Vertical)
{
float newOffset = CalculateColHorizontalOffset(groupSize, offset, currentBarSpace);
LayoutCol(_itemList, currentBarSpace, currentBarSize, workingSize, newOffset, padding.top, axis);
}
}
// Clear existing bar
_itemList.Clear ();
_itemList.Clear();
// Add the current bar space to total barSpace accumulator, and reset to 0 for the next row
offset += currentBarSpace;
@ -202,31 +213,28 @@ namespace UnityEngine.UI.Extensions
currentBarSpace = 0;
currentBarSize = 0;
}
currentBarSize += childSize;
_itemList.Add (child);
_itemList.Add(child);
// We need the largest element height to determine the starting position of the next line
if (childOtherSize > currentBarSpace) {
currentBarSpace = childOtherSize;
}
currentBarSpace = childOtherSize > currentBarSpace ? childOtherSize : currentBarSpace;
// Don't do this for the last one
if (i < rectChildren.Count - 1){
currentBarSize += spacingBetweenElements;
}
currentBarSize += spacingBetweenElements;
}
// Layout the final bar
if (!layoutInput) {
if (startAxis == Axis.Horizontal) {
float newOffset = CalculateRowVerticalOffset (groupHeight, offset, currentBarSpace);
if (!layoutInput)
{
if (StartAxis == Axis.Horizontal)
{
float newOffset = CalculateRowVerticalOffset(groupHeight, offset, currentBarSpace);
currentBarSize -= spacingBetweenElements;
LayoutRow (_itemList, currentBarSize, currentBarSpace, workingSize, padding.left, newOffset, axis);
}else if (startAxis == Axis.Vertical) {
LayoutRow(_itemList, currentBarSize, currentBarSpace, workingSize, padding.left, newOffset, axis);
}
else if (StartAxis == Axis.Vertical)
{
float newOffset = CalculateColHorizontalOffset(groupWidth, offset, currentBarSpace);
currentBarSize -= spacingBetweenElements;
LayoutCol(_itemList, currentBarSpace, currentBarSize, workingSize, newOffset, padding.top, axis);
@ -239,7 +247,8 @@ namespace UnityEngine.UI.Extensions
offset += currentBarSpace;
offset += counterOffset;
if (layoutInput) {
if (layoutInput)
{
SetLayoutInputForAxis(offset, offset, -1, axis);
}
return offset;
@ -247,87 +256,109 @@ namespace UnityEngine.UI.Extensions
private float CalculateRowVerticalOffset(float groupHeight, float yOffset, float currentRowHeight)
{
if (IsLowerAlign) {
if (IsLowerAlign)
{
return groupHeight - yOffset - currentRowHeight;
} else if (IsMiddleAlign) {
return groupHeight * 0.5f - _layoutHeight * 0.5f + yOffset;
} else {
return yOffset;
}
else if (IsMiddleAlign)
{
return groupHeight * 0.5f - _layoutHeight * 0.5f + yOffset;
}
return yOffset;
}
private float CalculateColHorizontalOffset(float groupWidth, float xOffset, float currentColWidth)
{
if (IsRightAlign) {
if (IsRightAlign)
{
return groupWidth - xOffset - currentColWidth;
} else if (IsCenterAlign) {
return groupWidth * 0.5f - _layoutWidth * 0.5f + xOffset;
} else {
return xOffset;
}
else if (IsCenterAlign)
{
return groupWidth * 0.5f - _layoutWidth * 0.5f + xOffset;
}
return xOffset;
}
protected void LayoutRow(IList<RectTransform> contents, float rowWidth, float rowHeight, float maxWidth, float xOffset, float yOffset, int axis)
{
var xPos = xOffset;
if (!ChildForceExpandWidth && IsCenterAlign) {
if (!ChildForceExpandWidth && IsCenterAlign)
{
xPos += (maxWidth - rowWidth) * 0.5f;
} else if (!ChildForceExpandWidth && IsRightAlign) {
}
else if (!ChildForceExpandWidth && IsRightAlign)
{
xPos += (maxWidth - rowWidth);
}
var extraWidth = 0f;
var extraSpacing = 0f;
if (ChildForceExpandWidth) {
extraWidth = (maxWidth - rowWidth)/_itemList.Count;
if (ChildForceExpandWidth)
{
extraWidth = (maxWidth - rowWidth) / contents.Count;
}
else if (ExpandHorizontalSpacing) {
extraSpacing = (maxWidth - rowWidth)/(_itemList.Count - 1);
if (_itemList.Count > 1) {
if (IsCenterAlign) {
xPos -= extraSpacing * 0.5f * (_itemList.Count - 1);
} else if (IsRightAlign) {
xPos -= extraSpacing * (_itemList.Count - 1);
else if (ExpandHorizontalSpacing)
{
extraSpacing = (maxWidth - rowWidth) / (contents.Count - 1);
if (contents.Count > 1)
{
if (IsCenterAlign)
{
xPos -= extraSpacing * 0.5f * (contents.Count - 1);
}
else if (IsRightAlign)
{
xPos -= extraSpacing * (contents.Count - 1);
}
}
}
for (var j = 0; j < _itemList.Count; j++) {
for (var j = 0; j < contents.Count; j++)
{
var index = IsLowerAlign ? contents.Count - 1 - j : j;
var index = IsLowerAlign ? _itemList.Count - 1 - j : j;
var rowChild = _itemList[index];
var rowChild = contents[index];
var rowChildWidth = LayoutUtility.GetPreferredSize(rowChild, 0) + extraWidth;
var rowChildHeight = LayoutUtility.GetPreferredSize(rowChild, 1);
if (ChildForceExpandHeight)
{
rowChildHeight = rowHeight;
}
rowChildWidth = Mathf.Min(rowChildWidth, maxWidth);
var yPos = yOffset;
if (IsMiddleAlign) {
if (IsMiddleAlign)
{
yPos += (rowHeight - rowChildHeight) * 0.5f;
} else if (IsLowerAlign) {
}
else if (IsLowerAlign)
{
yPos += (rowHeight - rowChildHeight);
}
if (ExpandHorizontalSpacing && j > 0) {
if (ExpandHorizontalSpacing && j > 0)
{
xPos += extraSpacing;
}
if (axis == 0) {
SetChildAlongAxis (rowChild, 0, xPos, rowChildWidth);
} else {
SetChildAlongAxis (rowChild, 1, yPos, rowChildHeight);
if (axis == 0)
{
SetChildAlongAxis(rowChild, 0, xPos, rowChildWidth);
}
else
{
SetChildAlongAxis(rowChild, 1, yPos, rowChildHeight);
}
// Don't do horizontal spacing for the last one
if (j < _itemList.Count - 1) {
if (j < contents.Count - 1)
{
xPos += rowChildWidth + SpacingX;
}
}
@ -337,39 +368,49 @@ namespace UnityEngine.UI.Extensions
{
var yPos = yOffset;
if (!ChildForceExpandHeight && IsMiddleAlign) {
if (!ChildForceExpandHeight && IsMiddleAlign)
{
yPos += (maxHeight - colHeight) * 0.5f;
} else if (!ChildForceExpandHeight && IsLowerAlign) {
}
else if (!ChildForceExpandHeight && IsLowerAlign)
{
yPos += (maxHeight - colHeight);
}
var extraHeight = 0f;
var extraSpacing = 0f;
if (ChildForceExpandHeight) {
extraHeight = (maxHeight - colHeight)/_itemList.Count;
if (ChildForceExpandHeight)
{
extraHeight = (maxHeight - colHeight) / contents.Count;
}
else if (ExpandHorizontalSpacing) {
extraSpacing = (maxHeight - colHeight)/(_itemList.Count - 1);
if (_itemList.Count > 1) {
if (IsMiddleAlign) {
yPos -= extraSpacing * 0.5f * (_itemList.Count - 1);
} else if (IsLowerAlign) {
yPos -= extraSpacing * (_itemList.Count - 1);
else if (ExpandHorizontalSpacing)
{
extraSpacing = (maxHeight - colHeight) / (contents.Count - 1);
if (contents.Count > 1)
{
if (IsMiddleAlign)
{
yPos -= extraSpacing * 0.5f * (contents.Count - 1);
}
else if (IsLowerAlign)
{
yPos -= extraSpacing * (contents.Count - 1);
}
}
}
for (var j = 0; j < _itemList.Count; j++) {
for (var j = 0; j < contents.Count; j++)
{
var index = IsRightAlign ? contents.Count - 1 - j : j;
var index = IsRightAlign ? _itemList.Count - 1 - j : j;
var rowChild = contents[index];
var rowChild = _itemList[index];
var rowChildWidth = LayoutUtility.GetPreferredSize(rowChild, 0) ;
var rowChildWidth = LayoutUtility.GetPreferredSize(rowChild, 0);
var rowChildHeight = LayoutUtility.GetPreferredSize(rowChild, 1) + extraHeight;
if (ChildForceExpandWidth) {
if (ChildForceExpandWidth)
{
rowChildWidth = colWidth;
}
@ -377,25 +418,32 @@ namespace UnityEngine.UI.Extensions
var xPos = xOffset;
if (IsCenterAlign) {
if (IsCenterAlign)
{
xPos += (colWidth - rowChildWidth) * 0.5f;
} else if (IsRightAlign) {
}
else if (IsRightAlign)
{
xPos += (colWidth - rowChildWidth);
}
//
if (ExpandHorizontalSpacing && j > 0) {
if (ExpandHorizontalSpacing && j > 0)
{
yPos += extraSpacing;
}
if (axis == 0) {
SetChildAlongAxis (rowChild, 0, xPos, rowChildWidth);
} else {
SetChildAlongAxis (rowChild, 1, yPos, rowChildHeight);
if (axis == 0)
{
SetChildAlongAxis(rowChild, 0, xPos, rowChildWidth);
}
else
{
SetChildAlongAxis(rowChild, 1, yPos, rowChildHeight);
}
// Don't do vertical spacing for the last one
if (j < _itemList.Count - 1) {
if (j < contents.Count - 1)
{
yPos += rowChildHeight + SpacingY;
}
}
@ -404,9 +452,9 @@ namespace UnityEngine.UI.Extensions
public float GetGreatestMinimumChildWidth()
{
var max = 0f;
for (var i = 0; i < rectChildren.Count; i++) {
for (var i = 0; i < rectChildren.Count; i++)
{
var w = LayoutUtility.GetMinWidth(rectChildren[i]);
max = Mathf.Max(w, max);
}
return max;
@ -415,20 +463,18 @@ namespace UnityEngine.UI.Extensions
public float GetGreatestMinimumChildHeigth()
{
var max = 0f;
for (var i = 0; i < rectChildren.Count; i++) {
for (var i = 0; i < rectChildren.Count; i++)
{
var w = LayoutUtility.GetMinHeight(rectChildren[i]);
max = Mathf.Max(w, max);
}
return max;
}
protected override void OnDisable()
{
m_Tracker.Clear();
LayoutRebuilder.MarkLayoutForRebuild(rectTransform);
}
}
protected override void OnDisable()
{
m_Tracker.Clear();
LayoutRebuilder.MarkLayoutForRebuild(rectTransform);
}
}
}

View File

@ -223,12 +223,21 @@ namespace UnityEngine.UI.Extensions
/// <summary>
/// used for changing / updating between screen resolutions
/// </summary>
public void UpdateLayout()
public void UpdateLayout(bool resetPositionToStart = false)
{
_lerp = false;
DistributePages();
if (resetPositionToStart)
{
_currentPage = StartingScreen;
}
if (MaskArea)
{
UpdateVisible();
}
SetScrollContainerPosition();
OnCurrentScreenChange(_currentPage);
}
@ -328,6 +337,10 @@ namespace UnityEngine.UI.Extensions
}
}
}
else if (distance == 0)
{
EndScreenChange();
}
}
}
}

View File

@ -218,11 +218,21 @@ namespace UnityEngine.UI.Extensions
/// <summary>
/// used for changing / updating between screen resolutions
/// </summary>
public void UpdateLayout()
public void UpdateLayout(bool resetPositionToStart = false)
{
_lerp = false;
DistributePages();
if (MaskArea) UpdateVisible();
if (resetPositionToStart)
{
_currentPage = StartingScreen;
}
if (MaskArea)
{
UpdateVisible();
}
SetScrollContainerPosition();
OnCurrentScreenChange(_currentPage);
}
@ -321,6 +331,10 @@ namespace UnityEngine.UI.Extensions
}
}
}
else if (distance == 0)
{
EndScreenChange();
}
}
}
}

View File

@ -287,7 +287,7 @@ namespace UnityEngine.UI.Extensions
PopulateMesh (vh, m_points);
}
else if (m_segments != null && m_segments.Count > 0) {
if (m_segments != null && m_segments.Count > 0) {
GeneratedUVs ();
vh.Clear ();
@ -296,8 +296,6 @@ namespace UnityEngine.UI.Extensions
PopulateMesh (vh, pointsToDraw);
}
}
}
private UIVertex[] CreateLineCap(Vector2 start, Vector2 end, SegmentType type)
@ -419,7 +417,7 @@ namespace UnityEngine.UI.Extensions
{
return Segments[segmentIndex - 1][index - 1];
}
else if (Segments.Count > 0)
else if (Segments?.Count > 0)
{
var segmentIndexCount = 0;
var indexCount = index;
@ -443,6 +441,29 @@ namespace UnityEngine.UI.Extensions
}
}
/// <summary>
/// Calculates the position of a point on the curve, given t (0-1), start point, control points and end point.
/// </summary>
/// <param name="t">Required Percentage between start and end point, in the range 0 to 1</param>
/// <param name="p1">Required Starting point</param>
/// <param name="p1">Required Control point 1</param>
/// <param name="p1">Required Control point 2</param>
/// <param name="p1">Required End point</param>
/// <returns>Vector2 position of point on curve at t percentage between p1 and p4</returns>
public Vector2 CalculatePointOnCurve(float t, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4)
{
var t2 = t * t;
var t3 = t2 * t;
var x = p1.x + (-p1.x * 3 + t * (3 * p1.x - p1.x * t)) * t + (3 * p2.x + t * (-6 * p2.x + p2.x * 3 * t)) * t +
(p3.x * 3 - p3.x * 3 * t) * t2 + p4.x * t3;
var y = p1.y + (-p1.y * 3 + t * (3 * p1.y - p1.y * t)) * t + (3 * p2.y + t * (-6 * p2.y + p2.y * 3 * t)) * t +
(p3.y * 3 - p3.y * 3 * t) * t2 + p4.y * t3;
return new Vector2(x, y);
}
/// <summary>
/// Get the Vector2 position of a line within a specific segment
/// </summary>
@ -478,6 +499,10 @@ namespace UnityEngine.UI.Extensions
{
m_points = new Vector2[1];
}
if (transform.GetComponent<RectTransform>().position != Vector3.zero)
{
Debug.LogWarning("A Line Renderer component should be on a RectTransform positioned at (0,0,0), do not use in child Objects.\nFor best results, create separate RectTransforms as children of the canvas positioned at (0,0) for a UILineRenderer and do not move.");
}
}
}
}
}

View File

@ -46,7 +46,13 @@ namespace UnityEngine.UI.Extensions
get
{
if (instance == null)
{
#if UNITY_2023_1_OR_NEWER
instance = GameObject.FindFirstObjectByType<BoundTooltipItem>();
#else
instance = GameObject.FindObjectOfType<BoundTooltipItem>();
#endif
}
return instance;
}
}

View File

@ -92,7 +92,13 @@ namespace UnityEngine.UI.Extensions
get
{
if (instance == null)
{
#if UNITY_2023_1_OR_NEWER
instance = FindFirstObjectByType<ToolTip>();
#else
instance = FindObjectOfType<ToolTip>();
#endif
}
return instance;
}
}

View File

@ -1,29 +1,24 @@
/// Credit SimonDarksideJ
using UnityEngine.EventSystems;
namespace UnityEngine.UI.Extensions
{
/*
Handy Selectable script to un-highlight a selectable component in Unity (e.g. a Button) when the user moves away from it, EVEN IF the user has holding a button on it.
Resolves the situation where Unity UI Components remain in a highlighted state even after the pointer has moved away (e.g. user holding a button, mouse, pointer down).
Now whenever the cursor leaves the component, it will force the UI component to revert to un-highlighted.
*/
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
/// <summary>
/// Handy Selectable script to un-highlight a selectable component in Unity (e.g. a Button) when the user moves away from it, EVEN IF the user has holding a button on it.
/// Resolves the situation where Unity UI Components remain in a highlighted state even after the pointer has moved away (e.g. user holding a button, mouse, pointer down).
/// Now whenever the cursor leaves the component, it will force the UI component to revert to un-highlighted.
/// </summary>
[AddComponentMenu("UI/Extensions/ResetSelectableHighlight", 31)]
[RequireComponent(typeof(Selectable))]
public class ResetSelectableHighlight : MonoBehaviour, IPointerExitHandler
{
[SerializeField]
private Selectable attachedSelectable;
private Selectable attachedSelectable = null;
// Start is called before the first frame update
void Awake()
private void Awake()
{
if (!attachedSelectable)
if (attachedSelectable == null || !attachedSelectable)
{
attachedSelectable = GetComponent<Selectable>();
}
@ -31,7 +26,12 @@ namespace UnityEngine.UI.Extensions
public void OnPointerExit(PointerEventData eventData)
{
if (!attachedSelectable.interactable)
{
return;
}
attachedSelectable.targetGraphic.CrossFadeColor(attachedSelectable.colors.normalColor, 0f, true, true);
}
}
}
}

View File

@ -40,6 +40,10 @@ namespace UnityEngine.UI.Extensions
bool updateLine = false;
for (int i = 0; i < transforms.Length; i++)
{
if (transforms[i] == null)
{
continue;
}
if (!updateLine && previousPositions[i] != transforms[i].position)
{
updateLine = true;
@ -60,6 +64,10 @@ namespace UnityEngine.UI.Extensions
// First, convert the pivot to worldspace
for (int i = 0; i < transforms.Length; i++)
{
if (transforms[i] == null)
{
continue;
}
worldSpaces[i] = transforms[i].TransformPoint(thisPivot);
}
@ -83,6 +91,10 @@ namespace UnityEngine.UI.Extensions
previousPositions = new Vector3[transforms.Length];
for (int i = 0; i < transforms.Length; i++)
{
if (transforms[i] == null)
{
continue;
}
previousPositions[i] = transforms[i].position;
}
}

View File

@ -1,35 +1,35 @@
{
"name": "com.unity.uiextensions",
"displayName": "Unity UI Extensions",
"version": "2.3.0",
"description": "An extension project for the Unity3D UI system, all crafted and contributed by the awesome Unity community",
"author": "Simon darkside Jackson <@SimonDarksideJ>",
"contributors": [
{
"name": "SimonDarksideJ",
"twitter": "@SimonDarksideJ"
}
],
"unity": "2020.3",
"repository": {
"type": "git",
"url": "git+https://github.com/Unity-UI-Extensions/com.unity.uiextensions.git"
},
"bugs": {
"url": "https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues"
},
"keywords": [
"Unity3D",
"Unity",
"Unity UI",
"UI Extensions"
],
"samples": [
{
"displayName": "UI Extensions Samples",
"description": "Examples and demonstrations of the Unity UI Extensions controls",
"path": "Examples~"
}
],
"license": "BSD3"
}
{
"name": "com.unity.uiextensions",
"displayName": "Unity UI Extensions",
"version": "2.3.2",
"description": "An extension project for the Unity3D UI system, all crafted and contributed by the awesome Unity community",
"author": "Simon darkside Jackson <@SimonDarksideJ>",
"contributors": [
{
"name": "SimonDarksideJ",
"twitter": "@SimonDarksideJ"
}
],
"unity": "2020.3",
"repository": {
"type": "git",
"url": "git+https://github.com/Unity-UI-Extensions/com.unity.uiextensions.git"
},
"bugs": {
"url": "https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues"
},
"keywords": [
"Unity3D",
"Unity",
"Unity UI",
"UI Extensions"
],
"samples": [
{
"displayName": "UI Extensions Samples",
"description": "Examples and demonstrations of the Unity UI Extensions controls",
"path": "Examples~"
}
],
"license": "BSD3"
}