I realize this question may be “silly” but I’m new to C#. I’m using this script example i found for a keypad:
void Update () {
Debug.Log (playerCode);
if (totalDigits == 4)
{
if(playerCode==correctCode)
{
playerCode = null;
theDoor.GetComponent<Animation> ().Play ();
theDoor.GetComponent<AudioSource> ().Play ();
Debug.Log ("Correct");
}
else
{
playerCode="";
totalDigits = 0;
Debug.Log ("Wrong");
}
}
}
void OnMouseUp()
{
GameObject.FindWithTag ("KeypadButton");
playerCode += gameObject.name;
totalDigits += 1;
keySound.GetComponent<PlaysoundScript> ().Clicky ();
}
This script works fine in the editor when using the mouse, But I want the “OnMouseUp Click” to be done with a gamepad button in the Input manager
I tried moving the OnMouseUp() function inside Update, adding Raycast etc.
What am I missing?
Any help would be appreciated, Thanks.