Any reason why Gameobject.setactive wouldn't work?

Using this very simple script to show/hide objects, worked fine before at some point before 2.42.0-pre but today it isn’t working, it console logs this.isShowing just fine too, hooked it up to a cube in the scene and the cube doesn’t show/hide when I call toggleShow() from a button in UI?

Original Post on Discord

by user 103054507105067008

mmmh I just tried adding the script to a object and that works fine. with setInterval(()=> this.toggleShow(), 1000)

ill try from a button now

that works fine too


I’ll zip up my scene if we get a sec to take a look, going to try just taking everything out the scene except a cube and the button + script. Even tried a Full Export and Play

by user 103054507105067008

I’ve pm’ed a minimal repro, no idea why its not working

by user 103054507105067008

by user 103054507105067008

both work fine for me - you didnt have a method assigned in one of your buttons

The browser console also warned about that

and these two look identical in the editor?

lights on and lights off are both yellow / look both turned on?


One of the buttons is to turn off the deck lights which you can see should disappear

by user 103054507105067008

I hooked it up to a cube instead if you try that the cube doesn’t hide/show

by user 103054507105067008

sending you a PM

Thanks for investigating, was user error :sweat_smile:

by user 103054507105067008