我对Unity中的脚本非常陌生,我正在尝试创建一个按钮,一旦点击它就需要模拟按下的'F'键(拿起一个项目)
这是我目前的代码,在写这篇文章之前,我已经看过整个团结论坛,但找不到任何有用的东西.
码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Collections;
public class button : MonoBehaviour {
public void ButtonToClick(int clickToButton)
{
SendKeys.Send("F");
}
}
Run Code Online (Sandbox Code Playgroud)