GithubHelp home page GithubHelp logo

ideka / unity-xboxctrlrinput Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jisyed/unity-xboxctrlrinput

0.0 1.0 0.0 375 KB

XboxCtrlrInput is a C# wrapper for Unity3D that aims to handle Xbox 360 controller input with multiple controllers on multiple platforms

License: Other

C# 100.00%

unity-xboxctrlrinput's Introduction

XboxControllerSVG

XboxCtrlrInput for Unity

Feel free to contribute. Requires at least Unity 5.0 or greater. Unfortunately older versions of Unity are no longer supported (it may work or not, but your miliage will vary).

Decription

XboxCtrlrInput is a wrapper written in C# for Unity3D that handles Xbox 360 controller input. It's used in the same way as Unity's Input class. My reasons for starting this project can be read here.

XboxCtrlrInput.cs itself is not a Unity script and thus does not need to be attached to any GameObject, since it contains no MonoBehavior derived classes in it.

XboxCtrlrInput.cs includes a C# namespace called XboxCtrlrInput. In that namespace there are three enumerations, XboxButton, XboxDPad, and XboxAxis. Most importantly, there is a static class called XCI that is used to get Xbox input.

Goals

The goals of XboxCtrlrInput are:

  1. To be able to make simple calls to Xbox controller input that works on Mac, Windows, and Linux (Ubuntu),
  2. And to be able to handle multiple Xbox controllers that works as you expect.

Installation

  1. Download the latest .unitypackage release.
  2. Import the package:
    Assets ▶ Import Package ▶ Custom Package...
  3. Update InputManager.asset file (to configure input axis and buttons):
    Window ▶ XboxCtrlrInput ▶ Replace InputManager.asset...

How to Use

  1. For any C# script where you want to use Xbox input, place using XboxCtrlrInput; at the top of the script under using UnityEngine;.

  2. The XboxCtrlrInput namespace includes the class XCI, which you will use to get Xbox input, such as:

bool didPressA = XCI.GetButton(XboxButton.A);

Note for OSX users: Be sure to install the latest version of the Tattie Bogle drivers. If you are making a native Mac build with either 64-bit or Universal binary, you need Unity 4.5 or greater. Input will not work if using older versions of Unity.

Note for OSX Yosemite users: Above download to Tattie Bogle drivers don't seem to work on Yosemite. Follow this blog post to help get Xbox controllers to work on Yosemite.

Note for Linux users: All of my Linux testing was done on Ubuntu 13.04 64-bit. To test 32-bit Unity builds on a 64-bit OS, I ran sudo apt-get install ia32-libs in a terminal. I am using the default Xbox controller driver that came with Ubuntu, which is known as xpad. I could not get Unity builds to cooperate with xboxdrv. Your milage may vary. For best results, make sure all your Xbox controllers are connected before testing anything.

What Works?

If you want to find out what currently works (such as button mappings), refer to the What Works page on the wiki. Compatability information can also be found there.

Update 11/7/13: Just so everyone knows, using the triggers with multiple controllers on a Windows web build won't probably work. Unfortunately this is a limitation of Microsoft's implementation of DirectInput. One controller will work fine though. See Issue #10.

Documentation

For documentation, including information about the included enumerations and methods, refer to the Coding References page on the wiki. A diagram showing all the labeled Xbox inputs can also be found there.

Issues

To see the latest bugs and limitations, refer to the repo's Issues section.

License

Everything in this repository is public domain, including the code and documentation art. I encourage everyone to use and even modify the code to your own specifications, and of course to contribute to this repo by forking the project. See UNLICENSE.md.

About the Example Project

XboxCtrlrInput includes a demo Unity project that requires Unity 4.3 or above. For more information about the demo, refer to the Example Unity Project page on the wiki.

demoScreenshot

unity-xboxctrlrinput's People

Contributors

ideka avatar karivargr avatar weeebox avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.