Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

This code switches between maps, just switch inputs as you wish. I used (InputGetKeyDown).

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class Mapswitcher : MonoBehaviour {

public GameObject map1, map2;

// Start is called before the first frame update
void Awake()
{
     map1.SetActive(true);
     map2.SetActive(false);
}

// Update is called once per frame
void Update()
{
    // Input.GetButtonDown("Mapswitch")

    if (Input.GetKeyDown("e"))
    {
        map1.SetActive(!map1.activeInHierarchy);
        map2.SetActive(!map2.activeInHierarchy);
    }
}

}

(+1)
I agree with him,I agree with him, much more simplified and functional
(+2)

Thank you very much :D