- Home /
Are there any tutorials for items action menu ?
Not sure how to name it. I mean while in adventure game and you click with the mouse on some objects there will be a popup menu with some actions like: look,take,open,hear,talk.
Are there any tutorials in youtube and just in sites ? Tried to google but didn't find. I wonder how can i create some nice pretty action menu.
Comment
Best Answer
Answer by toddisarockstar · May 01, 2017 at 01:39 AM
you would use a Raycast from camera to mouse to detect the object.
Then to make a screen display you would use the OnGUI function to display menus accordingly. the raycast is just a few simple lines you can find.
if ( Input.GetMouseButtonDown (0)){
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if ( Physics.Raycast (ray,out hit,100.0f)) {
print("i clicked on: " + hit.transform.name);
}
}
but you should start by googling a tutorial for basic unity screen displays to get started.