- Home /
UI Only Updates As Intended When Editing Through Scene
I am trying to make a single column width cascading menu. I have main categories with subcategories. The subcategories contain unknown amount of items which are displayed in two columns as boxes. Otherwise everything is in a single column.
Hierarchy looks like this:
MainCategory 1 | Vertical Layout Group
Text (category title)
Subcategory | Vertical Layout Group | Content Size Fitter
Text (subcategory title)
ItemContainer |Grid Layout Group |Content Size Fitter
item1
item2
item3
item4
Subcategory | Vertical Layout Group | Content Size Fitter
Text (subcategory title)
ItemContainer |Grid Layout Group | Content Size Fitter
item1
item2
MainCategory 2 | Vertical Layout Group
I've made a script that only leaves the clicked subcategory active and disables every other Subcategory GameObject.
When I go to play mode and start clicking on things the positioning of the UI elements goes wrong. Mainly some items appear to be positioned poorly.
However when the game is still running and in Scene view I manually try to move a locked UI element, everything all of a sudden falls into place. I would guess this is because some of the UI element event functions aren't being fired at appropriate times.
EDIT: It seems to have something to do with the content size fitters. I noticed that some of the content size fitters arent updating the height of the UI element properly. When I put a script that toggle the content size fitter off and on in Update it starts to work properly. I would however obviously want a cleaner solution.
Your answer
Follow this Question
Related Questions
2D Collider Isnt working 1 Answer
Multiple Cars not working 1 Answer
Unity crashes when using ExecuteAlways on a UIBehaviour 0 Answers
How to change anchor? 1 Answer
Distribute terrain in zones 3 Answers