- Home /
Vertical layout element alignment issue with content size fitter
I am trying to create a search list, and according to the query I am deactivating and activating elements of a vertical layout group. Hierarchy:
The elements are instantiate under Content. The Content gameobject has ContentSizeFitter and Vertical Layout Group.
I am using C# script to deactivate and activate elements like this:
foreach(MVPDListItem item in itemObjectList)
{ item.gameObject.SetActive(filteredList.Contains(item.mvpdName.text));
}
This enables and disabled elements based on the condition, and the elements are positioned because they are child of vertical layout group. These elements have LayoutElement over them with min and preferred width and height set to same value.
This is working fine on editor. I can see the list elements move up and down if some elements are enabled and disabled. But in device, the list is getting filtered, but items are not rendering correctly. I cannot see any element after enabling/disabling elements.
Unity Version: 2018.4.7f1
Your answer
![](https://koobas.hobune.stream/wayback/20220613033325im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Height Value of Rect Transform cannot be changed via script 1 Answer
How to lock element width or height in a vertical or horizontal layout? 1 Answer
how big is my app size 2 Answers
GridLayout dynamic cell size based on object count 0 Answers
[4.6 UI] Layouts messes with my object with/height even though force width/height is unchecked 0 Answers