Use this
public GameObject map1;
bool map1active;
public GameObject map2;
bool map2active;
// Start is called before the first frame update
void Awake()
{
map1active = true;
map1.SetActive(true);
map2active = false;
map2.SetActive(false);
}
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Jump"))
{
map1active = !map1active;
map2active = !map2active;
ChangeMap();
}
}
void ChangeMap()
{
map1.SetActive(map1active);
map2.SetActive(map2active);
}