Enable an image UI with code

Hi guys

I want to enable an image with this code, but it’s not working:

if (Input.GetKeyDown(KeyCode.Escape))
                AbaPause.enabled = true;

I’ve declared it as public image “AbaPause” and it’s inside a canvas and its sprite texture is sprite (2d and UI). I don’t know what’s going on.

Not sure from your description, but I have a feeling your AbaPause is a separate gameObject, and the whole gameObject needs to be enabled / disabled.

If that’s the case, AbaPause.gameObject.SetActive(true);

Thank you, now it works perfectly. The condition was in the wrong place. Thank you!