private GameObject _Car;
private float _Speed = 100;
void Start () {
_Car = Instantiate(Resources.Load("实例化物体名")) as GameObject;
}
void Update () {
if (Input.GetKeyDown(KeyCode.W))
{
_Car.transform.Translate(Vector3.forward * _Speed * Time.deltaTime);
}
if (Input.GetKeyDown(KeyCode.S))
{
_Car.transform.Translate(-Vector3.forward * _Speed * Time.deltaTime);
}
if (Input.GetKeyDown(KeyCode.A))
{
_Car.transform.Translate(Vector3.left * _Speed * Time.deltaTime);
}
if (Input.GetKeyDown(KeyCode.D))
{
_Car.transform.Translate(Vector3.right * _Speed * Time.deltaTime);
}
}