Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make a gameObject invisibe without making it inactive [duplicate]

Willing to make an image invisible to show other gameobjects behind it, but it has co-routine on script which wont run if it's inactive. Now I am making it inactive (with methode setActive(false)) to make it invisible based on events. So I want to run the coroutine and also make it invisible.

Is setting order in hierarchy a solution for this?

How to make it invisible without making it inactive/How can I achieve this and make coroutine running?

like image 866
bulliedMonster Avatar asked Dec 01 '25 01:12

bulliedMonster


1 Answers

You can do this by turning off the Renderer of the GameObject.

To disable:

gameObject.GetComponent<Renderer>().enabled = false;

Ref: https://docs.unity3d.com/ScriptReference/Renderer-enabled.html

like image 58
s0rana Avatar answered Dec 02 '25 14:12

s0rana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!