OnMouseDown for Xbox Controller
I have a Project where you can go around and cycle through different arrays of objects OnMouseDown. I wanted to be able to use a Xbox one controller with this but it doesn't recognize it. There are other objects in the scene that have a OnMouseOver function that seem to be working fine. I've changed my script to:
void Update() { if (Input.GetButtonDown("Fire1"))
However now, no matter where i click it will activate everything that had a OnMouseDown function.
Any Help greatly appreciated.
Answer by Bentoon · Jun 28, 2017 at 04:02 AM
Hi @zuzia1992 What about this : //set a boolean to be an on off
public bool myBool;
void Update () {
if(Input.GetButtonDown("Fire1")) {
if (myBool == true) { myBool = false; }
else if (myBool == false) { myBool = true; }
}
if (myBool)
{DoThis;}
else { DoThat; }
}
hope it helps
~be
Your answer
Follow this Question
Related Questions
Help with raycast!! 0 Answers
How do I use Input.GetButton, instead of OnMouse() 1 Answer
Raycast with image over collider 0 Answers
I can't get RayCast to report the collider I want. 1 Answer
Blink, Dash, Raycasting 0 Answers