Is there any chance you will fix the buggy update behaviour of the content size fitter (without having to use “ForceRebuildLayoutImmediate”, “RepaintAll” or “ForceUpdateCanvas” etc.)?
Especially when used with layout groups or nested into another game object with content size fitter, the necessary size calculations are not performed correctly (not in the right order i guess) which leads to the ui being not built up correctly or if so, only after a few “disable/enable switches” of the canvas.
Would be a real life saver to have this, because it is a pain to have to write a script for every single time i use a content size fitter.
Thanks guys!
Is there a bug report for this?
Are you using the content size fitter on objects whose parents have a layout group? If that’s the case, you should avoid that, it won’t work correctly in several situations (by design). Anyway, it will help the devs and everybody if you give an example of a setup that fails (and filling a bug report as jRocket commented if you didn’t already).
I rarely use content size fitters, but when I’ve used them the issues I had were caused by an improper setup from my part, and I could resolve them by fixing it, though sometimes it takes a bit to understand what the issue is.
@Trisibo Yes it often occured with layout groups, but not only and i can’t think of any other way of achieving something like a list of mission objectives with different text lengths in headline and copy for example. If there is a better way i would appreciate a hint
@jRocket Not sure if this is an actual bug report, but i guess it is: Unity Issue Tracker - Parent ContentSizeFitter doesn't update own size when child's ContentSizeFitter changes size
Also the issue is well known for years and being discussed in many forums, so i assumed the devs might be aware of it.
Unfortunately i don’t have any example to show right now, but you can see the issue in a post on reddit from 5 years ago: Reddit - Dive into anything
direct link to example from that post: 8w8u3
I see. As I just mentioned in other thread, I try to avoid content size fitters and just use layout groups and layout elements for most setups, definitely for the one you show. It took a bit to “click” in my head, and still sometimes can take some trial-and-error for some setups, but so far they have been rock-solid for me.
What you are asking for is more a feature request that will require a large rewrite of the layout system. Currently its not something that would be a quick fix based upon the architecture of layout. With the current focus on UI Toolkit features like this will currently not make the list for dev priority.
Its not a great answer i know and not the one you are likely hoping for. All that being said ContentSizeFitter has come up a lot already today in a short period of time so without any sort of promises its now higher on my radar.
I’m not sure if it is a feature request, since many other people expect the content size fitter to work that way and haven’t come around a solid way to do it differently, but i can understand that this is not very high on your priority list.
Could you probably recommend a resource that explains a practicable workaround for this?
1 Like