How to simulate a key press on button click - Unity
问题 I'm very new to scripting in Unity, I'm trying to create a button, and once clicked it needs to simulate the 'F' Key being pressed (To pick up an item) Here is the current code I have, I've looked all over unity forums before writing this but couldn't find anything that worked. Code: using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Collections; public class button : MonoBehaviour { public void ButtonToClick(int clickToButton) { SendKeys.Send("F"); }