using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ToggleBtn : MonoBehaviour
{
public Image check_on;
private Button toggleBtn;
// Start is called before the first frame update
void Start()
{
this.toggleBtn = this.GetComponent<Button>();
this.toggleBtn.onClick.AddListener(() => {
if(this.check_on.IsActive() == true)
{
Debug.Log("?");
this.check_on.enabled = false;
}
else
{
Debug.Log("!");
this.check_on.enabled = true;
}
});
}
// Update is called once per frame
void Update()
{
}
}
이 코드에서 isActive와 enable이 참조하는건,

안에 컴포넌트로 들어있는 이 image지

이름 옆에 있는 저 친구가 아니다.
저건 setActive로만 건드려지는것같다.
'C# > 문제해결' 카테고리의 다른 글
| 0816 유니티에 pmx 가져오기 (0) | 2022.08.16 |
|---|---|
| 0729 별 순서대로 나오게하기 (0) | 2022.07.29 |
| 0727 delegate 발생 시점 (0) | 2022.07.27 |
| 0726 Ray에 닿은것 내용 가져오는법 (0) | 2022.07.26 |
| 0719 백터 등에 수치 못넣는거 해결하는법 (0) | 2022.07.19 |