Combat Menu

I’m having trouble making my buttons work for my menu for a game. I want to use the up and down arrow keys, so a lot of the tutorials aren’t helping that I’m searching since most of them are using the mouse. Here is what I have done so far:

3289043--254644--upload_2017-11-15_16-30-35.png

I’ve been told that the Input.GetKey gets you they key itself, but not if you press on it. I’ll have to change this because I want to be able to move up and down to and click on a button to attack. I’ll use Input.GetButtonDown instead if that works.

I’m very new to unity and programming, so if you guys could explain this in the most basic way possible, that would really help.

I’m pretty sure you want “KeyCode.UpArrow” or something like that. Type “KeyCode.” then look at your auto complete options :slight_smile: Right now, your script is trying to find the property or field on your class…

1 Like

Ok thank you! I had another question using the InputManager, and if I’m using it right. I used InputManager so my script would be easier to write and change later if I have to.
3289292--254678--upload_2017-11-15_21-37-5.png
I was told by my other team member that I could also setup the keys in the Input Manager than going with the GetKey, since you can name the actions of what you want to do with them. So instead Input.GetKey(KeyCode.UpArrow) I could do Input.GetButtonDown(“MenuUpDown”). I’m not sure how to make this work with my current script, since I keep getting this messagebox error.
3289292--254679--upload_2017-11-15_21-37-39.png

I was wondering what this meant? I guess it is just not transferring over with what I made the InputManager. I’ve been looking up and I am still kind of confused on what I would need to do.

Here is what I tried to change in my script if that helps:
3289292--254680--upload_2017-11-15_21-38-23.png

Yes, you can use the input manager, but that error doesn’t appear to be related in the least.