Search Unity

Question Using Content Size Fitters With Layout Groups

Discussion in 'UGUI & TextMesh Pro' started by Geeknerd1337, May 26, 2022.

  1. Geeknerd1337


    Jun 5, 2013
    Hello, I am currently working on a weapon selection UI to similar to Half-Life's as shown in the screen shot below:

    As you can see, when selecting a specific weapon category, the column elements to the right expand out.
    I am attempting to do something similar using content size fitters and layout groups, but I'm running into some issues.

    Here is my hierarchy:
    And here is how it looks in the editor:

    Currently, these items have a content size fitter on them:

    The issue I'm having is two-fold. I want to be able to instantiate new columns as well as toggle the closed and open icon panels and have the layout update accordingly. The problem is first, I am getting errors along the lines of 'layout group in parent' for the content size fitters, and additionally if I just up and ignore this, if I add a new column or toggle the closed/open icons, the layout seems not to layout properly or it takes a second or two to update.

    If anyone can offer any advice it would be greatly appreciated.

    Attached Files: