I have other code that uses this same kind of format but for some reason this one is not working. Is there a specific reason why? It is connected to a game object and if I were to not use the if statement then it would work but I don't see why the if statement would be an issue.
The code is being used to close and open a Raw Image element that is nested within another Canvas.
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class Invetory : MonoBehaviour
{
void Update()
{
if (Input.GetKeyDown("Q"))
this.gameObject.active = true;
}
}