Gamepad: Accelerate with button, steer with d-pad

Hello,

is there any script already available that let’s me drive a car using a gamepad, but…

I want to use the d-pad for steering left and right and accelerate the car with a button (a,b,x or y).

I do not want to use the sticks nor the d-pad for acceleration.

What I have managed is setting up all Xbox Controller inputs in the (old) Input manager and a script that shows me every button is working correctly.
But since I have no skills in programming, I can’t get it to work. Input.GetAxis is apparently not working with buttons, so every script I find is useless to me.

You would not believe for how long I have roamed the internet to find a working solution.

Help would be much appreciated!

You want to use Input.GetButton for inputs that are either pressed or not pressed: Unity - Scripting API: Input.GetButton

Hi Grozzler,

yes, I know that. But since I can’t program I can’t use any script that uses GetAxis for acceleration. I don’t understand how to change a script so it uses a button instead of an axis and still functions. GetAxis uses float and getbutton is a bool. And that is where my knowledge ends.

How would I script ramping up acceleration to a maximum value to a button as long as it is pressed? :face_with_spiral_eyes:

And Youtube is where it can easily pick up and grow forever more! If you are just starting out, I highly recommend some simple tutorials like these because they will give you a HUGE leg up:

Imphenzia / imphenzia - super-basic Unity tutorial:

https://www.youtube.com/watch?v=pwZpJzpE2lQ

Jason Weimann:

https://www.youtube.com/watch?v=OR0e-1UBEOU

Brackeys super-basic Unity Tutorial series:

https://www.youtube.com/watch?v=IlKaB1etrik

Sebastian Lague Intro to Game Development with Unity and C#:

https://www.youtube.com/watch?v=_cCGBMmMOFw

How to do tutorials properly:

Tutorials are a GREAT idea. Tutorials should be used this way:

Step 1. Follow the tutorial and do every single step of the tutorial 100% precisely the way it is shown. Even the slightest deviation (even a single character!) generally ends in disaster. That’s how software engineering works. Every single letter must be spelled, capitalized, punctuated and spaced (or not spaced) properly. Fortunately this is the easiest part to get right. Be a robot. Don’t make any mistakes. BE PERFECT IN EVERYTHING YOU DO HERE.

If you get any errors, learn how to read the error code and fix it. Google is your friend here. Do NOT continue until you fix the error. The error will probably be somewhere near the parenthesis numbers (line and character position) in the file. It is almost CERTAINLY your typo causing the error, so look again and fix it.

Step 2. Go back and work through every part of the tutorial again, and this time explain it to your doggie. See how I am doing that in my avatar picture? If you have no dog, explain it to your house plant. If you are unable to explain any part of it, STOP. DO NOT PROCEED. Now go learn how that part works. Read the documentation on the functions involved. Go back to the tutorial and try to figure out WHY they did that. This is the part that takes a LOT of time when you are new. It might take days or weeks to work through a single 5-minute tutorial. Stick with it. You will learn.

Step 2 is the part everybody seems to miss. Without Step 2 you are simply a code-typing monkey and outside of the specific tutorial you did, you will be completely lost. If you want to learn, you MUST do Step 2.

Of course, all this presupposes no errors in the tutorial. For certain tutorial makers (like Unity, Brackeys, Imphenzia, Sebastian Lague) this is usually the case. For some other less-well-known content creators, this is less true. Read the comments on the video: did anyone have issues like you did? If there’s an error, you will NEVER be the first guy to find it.

Beyond that, Step 3, 4, 5 and 6 become easy because you already understand!

That’s because GetAxis only works for analog, is this how the analog information is processed. While Input.GetButton is bool because it only says if the button is pressed or not.

I strongly recommend that you study those things, even if programming isn’t your strongly skill. Not only to have the acknowledge about it, but also to figure out what to do if that script you’ve just downloaded from somewhere else don’t work properly.
Honestly, even if there are some tools that allow an non-programmer to work with games, making it without the skill will be extremely difficult.

So it’s fiverr then. :wink: Thx.

That’s all nice Kurt, but why do you invest so much energy in explaining how to use Google or YouTube when you don’t know whether I start out or may have already watched those or used Google to find a solution?
I came here for help, maybe you should let people be, do not judge them and just help IF you know something or else give other users the space to answer.