Whats a good way of making a GUI element either visible/invisble or active/inactive.
Using active/inactive is a pain as you need to manage the object. Is there a way of turning the renderer off ?
Whats a good way of making a GUI element either visible/invisble or active/inactive.
Using active/inactive is a pain as you need to manage the object. Is there a way of turning the renderer off ?
Simply disabling the UI (Image/ Text/ …) Component stops the element from rendering.
If you mean Active/Inactive is annoying as you need to manage the objects.
I tried using “enabled” but it doesn’t seem have a traditional renderer , so :
gameObject.renderer.enabled = false;
Doesn’t work.
Ok, worked out a way of doing it at least to the Canvas which might be good enough.
gameObject…GetComponent(Canvas).enabled = false;
Right, that’s because the rendering is done from the Component itself. For example, try:
yourObject.GetComponent<Button>().enabled = false;
EDIT: Ah, beat me to it! And I see you’re using JS. But yeah, that’s the way to go then. =)