var A : boolean = Input.GetKey(KeyCode.Joystick1Button0);
EditorGUILayout.Toggle("A", A);
So yeah, that toggle wants to read false, even after Button0 is being pressed. Am I just not using the toggle code correctly? Unity isn’t complaining…
var A : boolean = Input.GetKey(KeyCode.Joystick1Button0);
EditorGUILayout.Toggle("A", A);
So yeah, that toggle wants to read false, even after Button0 is being pressed. Am I just not using the toggle code correctly? Unity isn’t complaining…
I believe you want to go:
//put this outside the function. in global scope.
var A : boolean;
//now we're in our function
A = Input.GetKey(KeyCode.Joystick1Button0);
//this next line is the line you want to look at:
A = EditorGUILayout.Toggle("A", A);
Good luck!
-JFFM
I thought about that, but I thought it might be a bit of a paradox, telling it A was equal to two different things?
EDIT : No change. I dont want the user to be able to edit the boolean just by checking it, I just want it to reflect the status of that particular input. That’s why I left “A =” off of the EditorGUILayout
It’s not a paradox, it’s how it works.
Well I’d like to say solved, but sadly it isn’t.
The current code:
var A : boolean;
var B : boolean;
var X : boolean;
var Y : boolean;
class Xbox360ControllerMonitor extends EditorWindow {
@MenuItem ("Window/Xbox 360 Controller Monitor")
static function Init () {
var Monitor : Xbox360ControllerMonitor = EditorWindow.GetWindow (Xbox360ControllerMonitor);
Monitor.Show ();
}
function OnGUI () {
A = Input.GetKey(KeyCode.Joystick1Button0);
B = Input.GetKey(KeyCode.Joystick1Button1);
X = Input.GetKey(KeyCode.Joystick1Button2);
Y = Input.GetKey(KeyCode.Joystick1Button3);
A = EditorGUILayout.Toggle("A", A);
B = EditorGUILayout.Toggle("B", B);
}
}