Change text in layout group with no redraw weirdness
I have a main vertical layout group.
Inside the that group is a UI Text and another vertical layout group (player options). The UI Text can be any size of text, from a single line to a paragraph. The player options group can have 1 or a few elements with in it.
The UI Text (yellow area below) has a content size fitter with vertical set to preferred. This does throw a warning because it is already inside a layout group.
When an player option is clicked new text replaces the yellow UI Text area. Sometimes the new text flows in find and pushes down the player options group. Other times the the text pops up and then snaps into place. I'm guessing Unity is recalculating the content fitter and while that is happening the layout goes to hell.
In the image below you can see how the text pushes out of the vertical container. A moment later the text snaps back into the correct location. I'm guessing that is how long it takes Unity to calculate the new text vertical height.
Question
Is there a way to avoid flickering text (gameobject active/inactive) or weird layout redrawing processes and maintain a decent layout?
I've tried a number of different ways to solve this issue. I've tried removing the main vertical group, removing the text content fitter (using vertical overflow) and adjusting the position of the player options based on the new text preferred size. But again it takes too long to calculate the new height and the player options either float in the next for a moment or I have to toggle its active state which then creates a "flicker" or blink of the player options.
Is there a correct way to do this? Or is it impossible without causing some type of flicker or blinking of text or player options.
Hi @ecesis_llc , Did you figure out a solution to this? I am having the same challenge and think I've exhausted all possible solutions with no luck. Would love to know how you solved this. Thanks!
Your answer
Follow this Question
Related Questions
Why is this List only showing one int? 0 Answers
Messenger-like layout grid 0 Answers
How to keep panel inside scroll area when panel is shrunk? 0 Answers
Prevent expandable object from shrinking 1 Answer
Unity UI Prevent Layout component Update 0 Answers