중첩된 LayoutView가 제대로 작동하지 않을 때
LabelGroup과
하위의 BranchLabel, TagLabel에 모두 HorizontailLayoutView가 있음
하위의 LayoutView가 업데이트 내역이 상위 LayoutView에 제때에 적용이 안되서 문제인듯?
Solution (야매)
상위 Layout Group의 Control Child Size 체크하니까 된다
Solution (덜 야매)
👹원인
😀해결
ContentSizeFilter는 자손 컨텐츠의 크기에 따라 자동으로 LayoutView의 크기를 맞춰주는 역할을 하는 컴포넌트.
ContentSizeFilter를 임의로 Refresh시킴.
[SerializeField] private ContentSizeFitter sizeFitter;
private void RefreshContentSize()
{
System.Collections.IEnumerator Routine()
{
sizeFitter.verticalFit = ContentSizeFitter.FitMode.Unconstrained;
yield return null;
sizeFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
}
StartCoroutine(Routine());
}
[UI] How to force Content Size Fitter Update after instantiating a prefab?
Hi everyone, I have a quite complexe interface with scroll rect and everything. All is ok BUT, when i instantiate a prefab in a parent which contains a content size fitter component, the size is not update until i enable/disable the game object in the edit
discussions.unity.com
여기보면 LayoutView의 Spacing값을 약간 변화시켜서 바꾸는 방법도 있다.