I am coming from this from an artist view so my scripting is simplistic.
How do I get the xbox controllers’ buttons to cause events in Unity
ie. I’d like "A’ to pull up a menu (show canvas) and “B” to put the menu away (hide canvas).
I am coming from this from an artist view so my scripting is simplistic.
How do I get the xbox controllers’ buttons to cause events in Unity
ie. I’d like "A’ to pull up a menu (show canvas) and “B” to put the menu away (hide canvas).
Go to Projectsettings > input, then use this map to change them to ones
required http://wiki.unity3d.com/index.php/Xbox360Controller
Well I think that is all set up.
Here is what I think might work?
using UnityEngine;
public class ControlerWatcher : MonoBehaviour
{
void Update( )
{
if( Input.GetKeyDown( KeyCode.0 ) )
//Code for A button;
if( Input.GetKeyDown( KeyCode.1 ) )
//Code for B button;
if( Input.GetKeyDown( KeyCode.2 ) )
//Code for X button
if( Input.GetKeyDown( KeyCode.3 ) )
//Code for Y button;
if( Input.GetKeyDown( KeyCode.4 ) )
//Code for Left Trigger button;
if( Input.GetKeyDown( KeyCode.5 ) )
//Code for Right Triger button
if( Input.GetKeyDown( KeyCode.6 ) )
//Code for Back button;
if( Input.GetKeyDown( KeyCode.7 ) )
//Code for Start button;
}
}
I’m hoping @ the:
if( Input.GetKeyDown( KeyCode.0 ) )
//Code for A button;
That I can do something like:
if( Input.GetKeyDown( KeyCode.0 ) )
Plane.visibility == true;
But I know that I am just scratching at it and I need a little help.
You should always test by throwing a debug.log in there :P,