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값을 약간 변화시켜서 바꾸는 방법도 있다.
'Unity > Unity 리서치' 카테고리의 다른 글
Dependency hunter (0) | 2023.12.13 |
---|---|
스크롤뷰 두개 동시에 움직이기 (0) | 2023.07.12 |
인스펙터(Inspector)에 테스트 버튼 만들기 (0) | 2023.06.11 |
내가 부모의 몇 번째 Active된 자식인지 반환하는 함수 (0) | 2023.06.07 |
Quaternion API 설명 (0) | 2023.05.11 |