I have found a scrip that changes levels when the player gets near a door. However I would like it to be a Key press.
Is there a way for me to change this script so that I can press E when i get close to change levels?
Thanks.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LevelControl : MonoBehaviour
{
public string levelName;
void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Player"))
{
SceneManager.LoadScene(levelName);
}
}
}