GameObject deactivates when key not pressed

So I just began coding in Unity, and I would like to activate indefinitely a GameObject, reffered below as “menuGroup”, when any key is pressed. The problem is that the object is only showing up when I press any key, it’s not staying as I want it to be. I tried anyKeyDown, but it’s only activating the GameObject for a single frame. Any suggestions?

Here is my code:

using UnityEngine;
using System.Collections;

public class MainMenuStart : MonoBehaviour {

	public GameObject startText;
	public GameObject startGroup;
	public GameObject menuGroup;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if (Time.time < 2)
		{
			startText.SetActive(false);
			menuGroup.SetActive(false);
		}
		else
		{
			startText.SetActive(true);
			menuGroup.SetActive(false);
			if (Input.anyKey)
			{
				startGroup.SetActive (false);
				menuGroup.SetActive (true);
			}
		}
	}
}

I’m sure that question sounds pretty newb-ish, but thank you in advance for your response.

The issue is that you’re turning off menu group inside the else statement and then waiting for a key input to turn it back on. This results in menuGroup turning on only when a key is pressed/held down. Try the following:

 using UnityEngine;
 using System.Collections;
 
 public class MainMenuStart : MonoBehaviour {
 
     public GameObject startText;
     public GameObject startGroup;
     public GameObject menuGroup;
 
     // Use this for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
         if (Time.time < 2)
         {
             startText.SetActive(false);
             menuGroup.SetActive(false);
         }
         else
         {
             startText.SetActive(true);
             if (Input.anyKey)
             {
                 startGroup.SetActive (false);
                 menuGroup.SetActive (true);
             }
         }
     }
 }

In the Update(), you set it to active=false again every time Time.time is not below 2. You should take a look at that again.