Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ValidusREV · Dec 04, 2014 at 01:27 AM · controllersupportxbox

How do I get my Xbox One controller to work with my mini game in Unity?

I am aware of the Input Manager but besides that I am unsure if there has to be any code that must be written. I just want to be able to assign the controls I have to my controller and have them working.

Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MrSoad · Dec 04, 2014 at 12:05 AM 0
Share

First please do not keep on posting the same question, we will just reject them! Can you post a pic of your Input Settings(Inspector View), and your scripts that handle the movement that you want the Xbox Controller to handle. Thanks.

avatar image ValidusREV · Dec 04, 2014 at 12:25 AM 0
Share

For some reason the site won't let me upload the pictures I took.

But

On my Input $$anonymous$$anager I have:

Name: ControllerAttack1P Positive Button: joystick button 0 Gravity:1000 Dead: 0.001 Sensitivity: 1000 Type: $$anonymous$$ey or $$anonymous$$ouse button Axis: X axis Joy Num: Get motion from all joysticks

The code I am trying to get to work is:

if (Input.GetButtonDown ("ControllerAttack1P")) { if(special == 5){ specialAttack (); special = 0; Input.GetAxis("ControllerAttack1P"); } }

avatar image MrSoad · Dec 04, 2014 at 12:36 AM 0
Share

Ok, if it is a button, which it looks like it is then try this :

 if (Input.GetButtonDown("ControllerAttack1P")) {
 
     Debug.Log("A Button pressed");
 }

$$anonymous$$ake sure this is being run in Update() not FixedUpdate() and let me know if the message is displayed in the Debug Window when you press "A" on the controller.

You use GetAxis for the Thumbsticks and the Trigger inputs only.

avatar image ValidusREV · Dec 04, 2014 at 12:48 AM 0
Share

Ok I wrote the code like that and the Debug Window did display the message "A button pressed".

avatar image MrSoad · Dec 04, 2014 at 12:58 AM 0
Share

Then your controller and input settings are working fine. It is something in the rest of your code that is preventing this from working how you want it to. As a starter for finding out use this :

 if (Input.GetButtonDown("ControllerAttack1P")) {
 
     Debug.Log("A Button pressed");
 
     if (special == 5) { 
     
         Debug.Log("special does = 5");
     
         //Put Debug Statements in the function you
         //call here to see what is and is not being
         //run.
         specialAttack(); 
         
         special = 0;
     } 
 }

Then continue to narrow down where the problem is via the Debug.Log method. You should be able to find out where it is going wrong, if you don't(after you have had a good try) then post your full script with the issue as a new question. Thanks!

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Pflobus · Dec 07, 2014 at 11:03 PM

There is another way. At least, I tried it with my PS3 controller, and a program called something like DS3 Controller. If I were you, and I wanted to switch the keycodes, or translate those keycodes (WASD) to the Xbox One controller, I would hook up the controller, because I think it should come with some charging cable, and if possible, use it with the computer. Then, just look up a 3rd party software. But I'm not sure about the Xbox One. I hope this helped :)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

XBox Controller Button Pressure? 1 Answer

Does Unity support AssetBundle on XboxOne and PlayStation4? 0 Answers

Controll 2 players with 2 different xbox controllers 1 Answer

Xbox Controller ObjectArray Scripting Error 1 Answer

Xbox controller numbers not always the same as game joysticks 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges