Hey, sooooo my problem is that I want to instead of clicking the button via mouse, i want it to press it via keycode ( I will lock the cursor as crosshair, the game i’m making is First Person). this is where i want to press the button. I’ve tried the other solutions with this problem but none of them works, the main goal has been achieved, but this small control problem is the only thing i can’t seem to solve.
using System.Collections;
public class DecisionCounter : MonoBehaviour
{
public int yes;
public int no;
public GameObject decisionPanel, decisionObject;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
public void YesButton() // this is the Button for the 'yes'
{
if (Input.GetKeyDown (KeyCode.F) || Input.GetButtonDown ("360_YButton")) //the keycode i want to use
{
yes += 1; // this is the thingy the button will do when pressed.
decisionPanel.SetActive (false);
decisionObject.SetActive (false);
}
}
public void NoButton()// the function for the 'no' button
{
if (Input.GetKeyDown (KeyCode.V) || Input.GetButtonDown ("360_YButton")) // this is the keycode i want to use
{
no += 1; // do this when pressed the V button
GameObject thePlayer = GameObject.Find ("ambotnalang");
pickup PickScript = thePlayer.GetComponent<pickup> ();
PickScript.dropObject ();
}
// PickScript.checkDrop ();
}
}
it would really be helpful if you can help me. (what? hahahah) Even a Pseudo Code would be helpful, but an example code is better, or whatever way you feel like <3 <3 thanks