728x90
SetIsOnWithoutNotify(bool isOn)
SetIsOnWithoutNotify(bool isOn)는 Toggle의 isOn 값을 변경하되, onValueChanged 이벤트는 트리거되지 않도록 함.
// onValueChanged 이벤트 등록
tglDistances[i].onValueChanged.AddListener((isOn) => OnToggleValueChanged(index, isOn));
// 초기화할 때 SetIsOnWithoutNotify 사용하여 상태 변경 (이벤트 호출 안 함)
tglDistances[i].SetIsOnWithoutNotify(false); // 이때 onValueChanged 이벤트는 발생하지 않음
728x90
'Unity' 카테고리의 다른 글
simulator is currently not active (0) | 2024.10.04 |
---|---|
Unity 시뮬레이터 (0) | 2024.09.27 |
LayoutRebuilder.ForceRebuildLayoutImmediate() 이 안먹히면 Canvas.ForceUpdateCanvases() (0) | 2024.09.27 |
ContentSizeFitter 적용 LayoutRebuilder.ForceRebuildLayoutImmediate (0) | 2024.09.26 |
RenderTexture.Create failed: width & height must be larger than 0UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (0) | 2024.09.20 |