This is a bit of an odd question and I’m not really sure how I’m suppose to ask it, but I have a dungeon crawler and a UI component in it that is suppose to open up a map. However, I obviously can’t have the map stay up all the time (it’s like a 500x500 image), so I need a way to close it. What I WANTED to do was just have the player click anywhere on the screen to close it when it’s open, but I don’t know quite how to do that. The only mouse events I know how to process are ones that happen when the mouse is clicking on/hovering over/exiting an object’s collider space. This is obviously not the same thing and I have no idea how to accomplish something like this.
Have a script attached to your map object. In the update function of the script check for mouse input and if it gets the input have it deactivate the object.
void Update () {
if (Input.GetMouseButtonDown (0) || Input.GetMouseButtonDown (1)) {
yourGameObject.SetActive (false);
}
}
1 Like
Yeah, that did it.