I have been trying to find a good simple way to simply turn on and off (Toggle) another UI image using a single UI button. Is there a simple way to do this?
zaid87
2
I’m not familiar with using canvas but maybe something like this should do. Since from what I’ve seen, the image will still be a GameObject. I made the image to be public so you can assign it in the editor instead (drag&drop):
public GameObject image;
void OnGUI(){
if(GUI.Button(new Rect(0,0,100,100), “Toggle Image”)){
image.SetActive(!image.active);
}
}