- Home /
Question by
linelade · May 15, 2019 at 02:38 PM ·
scripting problem
showing GUI on getkeydown only within a zone
hey everyone,
so I think this is suuuuper easy, im just not able to figure out how to do it
I have a a code for displaying a GUI canvas when you press "m". however I only want to be able to press m and actiavte that canvas within a certain zone (lets say collider)
heres the code i have so far
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class showtextinzone : MonoBehaviour {
public GameObject menunow;
private bool isShowing;
void Update () {
if (Input.GetKeyDown ("m"))
isShowing = !isShowing;
menunow.SetActive (isShowing);
}
}
Comment
Your answer
