I need to make a UI button invisible, but not by the command SetActive(false) because I need a script on it to run.
I tried below commands but none of them works, seems they are obsolete or wrong
Set scale to 0,0,0 also works in most circumstances (can cause some issues if you’ve got complex 3d objects in a world camera usage though). You just set it back to its live scale whenever you want it ‘enabled’.
I created a Youtube video which answers this question
Essentially you add a Canvas Group component to the Canvas with the controls you want to make invisible and access the Canvas Group in code and make it invisible and/or not interactive.
You could try making a new tag assigned to the buttons you want to be invisible and excluding them in a custom layer. If you use that layer on your camera it should render everything but the UI elements with the new tag.