Hi everyone. I have a menu which has a container with a horizontal layout group and a content size fitter. When i open the menu progression buttons are dynamically added as children of the horizontal layout group. I want to focus on the progression button that the player has reached (so the Player is automatically taken to the progression button). My problem is that i have to WaitForEndOfFrame to get the correct width of the container. I have tried using LayoutRebuilder.ForceRebuildLayoutImmediate, but it still returns 0 as the width. I have tried Googling my problem, but there seems to be no workaround? The nice thing about ContentSizeFitter is that i don’t have to do manual calculations while using it with a horizontal layout group, so i would love a fix, which does not involve using WaitForEndOfFrame (It causes visible jitter)
As a workaround, perhaps you can keep your canvas disabled (the component, not the gameobject) until the end of the frame? Will that prevent your jitter?
I wish i could just do that, but you are able to toggle between normal and hard mode, which means that i can’t just wait with enabling the canvas. If anyone knows a way to have a layout group and a content size fitter together and be able to get the correct width and height of the content, it would be much appreciated
Normal and hard toggle