- Home /
Question by
bojan1986819 · Apr 12, 2015 at 06:37 PM ·
c#imagedeactivatereactivation
deactivate Image(script) component on gameobject c#
I would like to deactivate(/reactivate) just the Image component of a gameobject in c# script but I don't know how. I tried to search for it but I could not find it. Sorry if I'm being too noob.
Comment
Best Answer
Answer by _joe_ · Apr 12, 2015 at 06:39 PM
This will work for any component,
(just make sure to add
using UnityEngine.UI;
at the top of the script since Image is part of the UI library).
In Start() for example, get that compoenent, and turn it off:
this.gameObject.GetComponent<Image>().enabled = false;
That's it!