Search Unity

Question Using Content Size Fitters With Layout Groups

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

  1. Geeknerd1337

    Geeknerd1337

    Joined:
    Jun 5, 2013
    Posts:
    52
    Hello, I am currently working on a weapon selection UI to similar to Half-Life's as shown in the screen shot below:
    upload_2022-5-26_8-19-24.png

    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:
    upload_2022-5-26_8-22-6.png
    And here is how it looks in the editor:
    upload_2022-5-26_8-22-37.png

    Currently, these items have a content size fitter on them:
    upload_2022-5-26_8-23-48.png

    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: