Very noob question and I’ve tried to see if this was answered somewhere else but couldn’t find a solution.
This is the code I’m using. The problem I’m having is that the object disappears, but when I press the assigned key again, it won’t reappear which is what I’d like for it to do.
I don’t know much about coding and I’m just starting to learn.
public GameObject glasses;
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("glassesKey"))
glasses.SetActive(!glasses.activeSelf);
}