hirarky您好,我有正确的面板和错误的面板,该面板用于检查对象是否在右侧插槽中拖放。但是在这段代码中,当我运行错误的面板时,它总是首先出现,然后再拖放对象。即使我将其设置为非活动状态。我该怎么解决?
public class CekBenar3 : MonoBehaviour
{
public float delay = 1;
[SerializeField]
private GameObject PanelBenar;
[SerializeField]
private GameObject PanelSalah;
void Start()
{
PanelBenar.SetActive(false);
PanelSalah.SetActive(false);
}
void Update()
{
if (Slot1.cek1 && Slot2.cek2 && Slot3.cek3)
{
GameObject objek1 = GameObject.FindGameObjectWithTag("Benar1");
GameObject objek2 = GameObject.FindGameObjectWithTag("Benar2");
GameObject objek3 = GameObject.FindGameObjectWithTag("Benar3");
if (objek1.transform.parent.tag == "Jawab1"
&& objek2.transform.parent.tag == "Jawab2"
&& objek3.transform.parent.tag == "Jawab3")
{
PanelBenar.SetActive(true);
}
else
{
PanelSalah.SetActive(true);
}
}
}
}