CONTROLLER INPUT in Unity!



Let’s set up Gamepad controls using the new Unity Input System!

► SIGN UP FOR JASON’S UNITY COURSES:

👕Check out our merch!

♥ Support Brackeys on Patreon:

····················································································

♥ Subscribe:

● Website:
● Facebook:
● Twitter:
● Instagram:
● Discord:

········································­­·······································­·­····

► All content by Brackeys is 100% free. We believe that education should be available for everyone. Any support is truly appreciated so we can keep on making the content free of charge.

········································­­·······································­·­····

♪ “ES_Dress Code_Black – oomiee” by Epidemic Sound

Nguồn: https://infernalaffairsguild.com/

Xem thêm bài viết khác: https://infernalaffairsguild.com/game/


Article Categories:
Game

Comments

  • Hey everyone!

    To those of you who can't find the package: Unity has moved the "Show Preview Packages".

    You can now find it under Edit -> Project Settings -> Package Manager -> Enable Preview Packages.

    If you check that box, you should see preview packages in the Package Manager! 🙂

    Stay awesome!

    Brackeys June 29, 2020 5:00 am Reply
  • unity won't let me use just left stick. It makes me set each one manually

    BaconBot June 29, 2020 5:00 am Reply
  • this tutorial is WAY too basic

    Monkey Robots Inc. June 29, 2020 5:00 am Reply
  • Anyone please. Should I use Incrontrol from Asset Store or Unity new Input System? Thanks in advance. What is better?

    Thanitsak Leuangsupornpong June 29, 2020 5:00 am Reply
  • playbackSpeed = 0.5f

    Dannzilla June 29, 2020 5:00 am Reply
  • Whenver i do this, the controller input still goes wild to one side even though i'm not touching it. I can't fathom why

    STANN.co June 29, 2020 5:00 am Reply
  • Thank, just what we were looking for. This is a great starting point. Next steps for us is to find out how to trigger animations using this method. Walk, Run, Jump, Punch, Kick.

    Alister Gray June 29, 2020 5:00 am Reply
  • Is there a way to contact you privately

    Clarence Duodu June 29, 2020 5:00 am Reply
  • When I went into the input I could only choose one direction for the stick

    Connor Weller June 29, 2020 5:00 am Reply
  • is this outdated? it gives error?

    Deccoyi June 29, 2020 5:00 am Reply
  • dude u dont know how much i love your job always very simple to understand even if im not english and the best tuto on youtube THANKS

    arcadebox June 29, 2020 5:00 am Reply
  • Thanks! This helped because im making a fun local multiplayer fighting game real quick that I can play with my brother and friends

    Epic7Ate9 June 29, 2020 5:00 am Reply
  • How to make vibration?
    Gamepad.current.SetMotorSpeeds(0.9f 0.2f);
    Does not make it vibrate.
    Edit: I realized I don't have a motor in my gamepad.

    Karpai June 29, 2020 5:00 am Reply
  • Very useful video as a starting point.

    I am very new to this (24 hours post Unity install!) but I come to this with a software developer's perspective. So some basic questions:

    I want to to use whatever controller I find plugged in for drone control. This might be a standard PSx controller etc, but more likely an RC transmitter, might be USB or Wireless connected. These controllers can be configured by the user any which way as to number of channels (stick control, buttons etc) and the ordering of those channels. Some might be inverted, and some appear to give out a signed value (-128 to +127) and some signed (0 to 2047).

    The point is, you don't know what you might find for any given controller, and the end user therefore has to set all this up for his/her specific controller in a game configuration page – at run time therefore, NOT in some IDE dialogue.

    Now I notice a lot of setup was done in the input manager IDE dialogue. My question therefore is, where do I find information to get below that to the raw data itself?

    Basically, what I really want to do is enumerate all controllers installed, and for each one, enumerate all channels they put out, and then read their values as they are manipulated. Connection / disconnection events wiuld be useful but not essential. Sounds pretty simple, but I cannot quite see how/where to do it?

    Any information available at that level?

    Nick W June 29, 2020 5:00 am Reply
  • How can i add Nintendo Wii Balance Board to Unity as a controller? EDIT: I bought WiiBuddy on Unity Asset Store.

    Hilal Turfullu June 29, 2020 5:00 am Reply
  • How would you tackle on screen touch controles with the new input system? Cause there are no tutorials on that right now.

    Like I'm trying to make a Dpad on the screen. But no clue how to tackle it properly without doing hacky stuff to make it work.

    Daan Gijzen June 29, 2020 5:00 am Reply
  • Upon installing the input manager I got this error message: "LibraryPackageCachecom.unity.inputsystem@1.0.0InputSystemEditorInternalEditorHelpers.cs(52,27): error CS0117: 'AssetDatabase' does not contain a definition for 'MakeEditable'"
    I can't find anything on google when I try to find a solution. Uninstalling and re-installing did not help. If anybody has dealt with this issue, please help.

    B Mc June 29, 2020 5:00 am Reply
  • what about using the d-pad? you din't cover that at all.

    Whose Gaming? June 29, 2020 5:00 am Reply
  • Im interested to see when the switch joy-cons can be implemented into the unity input system, or at least see how to make the input for the motion accelerator to work

    Tony Rahme June 29, 2020 5:00 am Reply
  • Hi, thanks for the tutorial; it worked how it was supposed to in the editor, but I quickly found out that my controller inputs didn't work after I built and ran the game to test it. Do you have an idea of why this happens because I'm stumped…
    Here's the controller I'm using: https://www.amazon.com/Controller-iNNEXT-Classic-Raspberry-Multicolored/dp/B01N48L71I/ref=sr_1_10?dchild=1&keywords=wired+gamepad+innext&qid=1588728204&s=electronics&sr=1-10
    Edit: I figured it out; I just needed to update the input system XD

    Devon Austin June 29, 2020 5:00 am Reply
  • SOS! Tried following the tutorial, but joystick wouldn't work. Now the keyboard doesn't work either. Reinstalling Unity didn't help. Can some please explain how to switch the Input mode back to keyboard?

    A J June 29, 2020 5:00 am Reply
  • Unity 2019.3.12f1 on MacOS and Xbox One Controller. I wasn't able to select the "Left Stick" option on the Binding Path, only its child (Up, Down, Left, Right). What I did was select any of the child and pressing the small "T" button I changed the text to "<Gamepad>/leftStick" and now it works fine.

    Joel Abad June 29, 2020 5:00 am Reply
  • Once I plugged my Xbox controller to my laptop with the batteries inside and it short circuited. Now after some troubleshooting, the movement on the Z axis is no longer there. Everyone make sure you all remove your controller batteries before plugging them in

    Shriansh Kumar June 29, 2020 5:00 am Reply
  • I know absolutely nothing about c# or any coding or anything it's just so overwhelming wat do I do?

    TroyOlogy June 29, 2020 5:00 am Reply
  • I can't select the whole stick!! HELP!!!!!!!!!!!!!! plssssss

    Unknown Admin June 29, 2020 5:00 am Reply
  • Imagine I did a really cool action-adventure game based on Spider-Man (my profile picture has Spider-CARNAGE and Venom shown on it), I can just figure out how to make a web-swing system where Spidey's webs hook to the buildings. Let's say I want Spider-Man to raycast if an anchor point for his spider silk ropes are in sight, if not, he will not shoot a spider-silk rope.

    DaffierNine June 29, 2020 5:00 am Reply
  • Doesn't work with 2019.3.10f1 ?

    Adrien de La Celle June 29, 2020 5:00 am Reply
  • Left stick is greyed out in the binding for both move and rotate

    PhilCodes June 29, 2020 5:00 am Reply
  • The code works great but I have some questions. One I try to change movement direction, I cant unless I let go of the stick and press it again at a different angle. Also, it moves slightly slower than it does when I configure the d pad or keyboard. Another thing is that the d pad and key board cant move diagonally, something that wasnt a problem with the old system. Is there a way I can make it move diagonally?

    ReviewChargersUSA June 29, 2020 5:00 am Reply
  • I got to 1:40 before my just redownloaded today version of Unity decided to tell me I don't have access to "Input Systems"… Well then. I know I need a new computer considering my system is using some weird default settings and it wouldn't even properly open visual studio when I tried to write script in Unity, and chose to open notepad instead, for some reason, despite me downloading VS with Unity. I must be an idiot or I messed up some important settings somewhere along the way. I think it's time I offload my essential files to an external drive and then wipe my system and start over with a clean slate

    ChronoFlation June 29, 2020 5:00 am Reply
  • Hello. I keep getting this error

    AssetsCube.cs(16,18): error CS1061: 'PlayerControls' does not contain a definition for 'Gameplay' and no accessible extension method 'Gameplay' accepting a first argument of type 'PlayerControls' could be found (are you missing a using directive or an assembly reference?)

    Myburgh Roux June 29, 2020 5:00 am Reply
  • How do i move in the Z direction also then? I cant use a vector3 as i get an error saying it cant read the value type of "Vector3"

    ZippyDoodah June 29, 2020 5:00 am Reply
  • How could I use this to program analog swoop actions i.e. like Street Fighter using a 45 deg swoop and the punch button to use the haduken move?

    Ezzy Poo June 29, 2020 5:00 am Reply
  • Amazing! thank you very much for helping me out with this!
    And if anyone was wondering, Input.GetKey still works with the new input system installed.

    Amelia Zirfa June 29, 2020 5:00 am Reply
  • Why did you create new Vector2's m, and r to use for movement rather than the original move, and rotate variables?
    Couldn't get this working for me. Button presses are registered, but not the movement

    Nicolaj Bunting June 29, 2020 5:00 am Reply
  • Hey, great video! I'm having trouble trying to get access to the controls from a second script. I created the same PlayerControls controls variable and initialized it the same way. I've also included the needed header and since the controls are enabled/disabled on the first script, I don't need to do it on the second one. I can't get it to register input though. Any advice? Thanks a lot

    Edit: Just got it working, apparently it also needs the enable/disable on the second script!

    Diogo Sousa June 29, 2020 5:00 am Reply
  • I'm looking forward to seeing this come out of preview, it reduces spaghetti code so much; need to get used to the syntax, but it makes things so much cleaner

    Carl Summers June 29, 2020 5:00 am Reply

Leave a Comment

Your email address will not be published. Required fields are marked *