- Home /
SetActive(false) not working
for some reason, this script doesn't work, I have it set to disabled at start and when the value appears it enables and there is a button to disable it, but the button just doesn't do anything. I have it all set up but the button just doesn't do anything.
here's my code:
public Slider sl;
public GameObject w;
void Update()
{
if (sl.value >= 194) { w.SetActive(true); }
}
public void close()
{
w.SetActive(false);
}
Comment
Answer by mak431020 · Aug 15, 2021 at 05:22 AM
Hope this is what you want.
void Update()
{
if(sl.value >= 194)
{
w.SetActive(true);
}
else
{
w.SetActive(false);
}
}
unfortunately it's not, I need a button to close it which is why it is in it's own void. I am thankful for the help though!
Did you set the button onClick Close() on the inspector