How to Hide Canvas Images

Asked 2 years ago, Updated 2 years ago, 75 views

I use the code below to hide the UI image.

GameObject.Find("Image").GetComponent<UnityEngine.UI.Image>().enabled=false;

With this hidden method, when I want to display it in another script, it seems that the UI image has not been obtained, but is there any other way to obtain the UI or hide it in another script?

unity3d

2022-09-30 17:50

1 Answers

I was also worried about something before, so I was able to solve it by referring to the following.
The corresponding item appears in the middle of the page.

Show or hide Button
http://qiita.com/2dgames_jp/items/b3d7d204895d67742d0c

gameObject.SetActive(false); is
GameObject.Find("Image").GetComponent().enabled=false;
I think it's okay to do.


2022-09-30 17:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.