how to make image enabled in unity code example
Example 1: unity how to make a ui disappear
using UnityEngine;
using UnityEngine.UI;
public class ScriptName : MonoBehaviour
{
[SerializeField]
private CanvasGroup Canvas;
void Awake()
{
Canvas.alpha = 0f;
Canvas.interactable = false;
Canvas.blocksRaycasts = false;
}
public void Click()
{
print("work");
Canvas.alpha = 1f;
Canvas.interactable = true;
Canvas.blocksRaycasts = true;
}
}
Example 2: disable an image in unity
image.enabled = true;
image.enabled = false;