InputMaster Xbox 360 Controls

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Setting Up The Scene)
(InputMaster Xbox 360 Controls)
Line 3: Line 3:
 
=== Initial Notes ===
 
=== Initial Notes ===
 
* If you haven't read the primer tutorial, [http://wiki.unity3d.com/index.php/InputMaster_Primer go read that '''now'''] before reading this.
 
* If you haven't read the primer tutorial, [http://wiki.unity3d.com/index.php/InputMaster_Primer go read that '''now'''] before reading this.
 +
* Xbox 360 support is currently only for the Windows editor and for Windows builds.
 
* This tutorial is NOT a Unity tutorial nor a primer to C# or programming in general. This tutorial assumes that you already have a good grasp of how Unity works and that you have intimate knowledge of programming concepts and the C# language.
 
* This tutorial is NOT a Unity tutorial nor a primer to C# or programming in general. This tutorial assumes that you already have a good grasp of how Unity works and that you have intimate knowledge of programming concepts and the C# language.
 
* BSGTools is C# '''ONLY'''. Unityscript and Boo are '''NOT''' supported.
 
* BSGTools is C# '''ONLY'''. Unityscript and Boo are '''NOT''' supported.
Line 11: Line 12:
 
We're going to base this scene off of the scene from [http://wiki.unity3d.com/index.php/InputMaster_Primer the primer tutorial].
 
We're going to base this scene off of the scene from [http://wiki.unity3d.com/index.php/InputMaster_Primer the primer tutorial].
  
Delete your PlayerController and InputManager scripts, as we're going to remake them in this tutorial.
+
Delete your InputManager script, as we're going to remake it in this tutorial.
 +
 
 +
You can either delete or leave your PlayerController script, we'll be making major adjustments to it.
 +
 
 +
Make sure that the editor is targeting Standalone Windows for builds.
 +
 
 +
== Creating the Controls ==
 +
 
 +
Create a new InputManager script like the one from the primer tutorial, except stop after you've set up the InputMaster instance.
 +
 
 +
We're going to recreate the KeyControls in order. There are 3 types of XboxControls:
 +
 
 +
* XButtonControl
 +
** Has two bindings
 +
*** Positive - REQUIRED
 +
*** Negative - Optional
 +
** The bindings are of type XButton:
 +
*** A/B/X/Y Face Buttons
 +
*** Up/Down/Left/Right DPad
 +
*** The shoulder buttons
 +
*** The Back, Start and Guide buttons
 +
*** The Stick buttons (pressing in the analog sticks)
 +
** Conceptually identical to the KeyControl
 +
* XStickControl
 +
** Has one binding
 +
*** Positive - REQUIRED
 +
** The binding is of type XStick:
 +
*** Left Stick X Axis
 +
*** Left Stick Y Axis
 +
*** Right Stick X Axis
 +
*** Right Stick Y Axis
 +
* XTriggerControl
 +
** Has one binding
 +
*** Positive - REQUIRED
 +
** The binding is of type XTrigger
 +
*** Left Trigger
 +
*** Right Trigger
 +
** Functions as you expect. Does not have Unity's flaw of the Triggers being interpreted as one axis.

Revision as of 20:16, 6 November 2014

Contents

InputMaster Xbox 360 Controls

Relevant for version v7.1.1b

Initial Notes

  • If you haven't read the primer tutorial, go read that now before reading this.
  • Xbox 360 support is currently only for the Windows editor and for Windows builds.
  • This tutorial is NOT a Unity tutorial nor a primer to C# or programming in general. This tutorial assumes that you already have a good grasp of how Unity works and that you have intimate knowledge of programming concepts and the C# language.
  • BSGTools is C# ONLY. Unityscript and Boo are NOT supported.
  • InputMaster was designed for programmers, by a programmer. It has no configurable options in the Inspector, and should not be manually added to a GameObject for any reason. All configuration is done in code. However, if you'd like to make some variables editable in the Inspector, you can expose them through your InputManager.
  • It is worth mentioning that this tutorial uses a Singleton pattern to provide access to the InputManager script we will be creating. This pattern is easy and fast to implement, which is why I'm using it here. Some people argue that the Singleton pattern is bad design. Regardless, this is a beginner's tutorial, and I'll be treating it as such.

Setting Up The Scene

We're going to base this scene off of the scene from the primer tutorial.

Delete your InputManager script, as we're going to remake it in this tutorial.

You can either delete or leave your PlayerController script, we'll be making major adjustments to it.

Make sure that the editor is targeting Standalone Windows for builds.

Creating the Controls

Create a new InputManager script like the one from the primer tutorial, except stop after you've set up the InputMaster instance.

We're going to recreate the KeyControls in order. There are 3 types of XboxControls:

  • XButtonControl
    • Has two bindings
      • Positive - REQUIRED
      • Negative - Optional
    • The bindings are of type XButton:
      • A/B/X/Y Face Buttons
      • Up/Down/Left/Right DPad
      • The shoulder buttons
      • The Back, Start and Guide buttons
      • The Stick buttons (pressing in the analog sticks)
    • Conceptually identical to the KeyControl
  • XStickControl
    • Has one binding
      • Positive - REQUIRED
    • The binding is of type XStick:
      • Left Stick X Axis
      • Left Stick Y Axis
      • Right Stick X Axis
      • Right Stick Y Axis
  • XTriggerControl
    • Has one binding
      • Positive - REQUIRED
    • The binding is of type XTrigger
      • Left Trigger
      • Right Trigger
    • Functions as you expect. Does not have Unity's flaw of the Triggers being interpreted as one axis.
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox