【发布时间】:2022-12-05 21:38:58
【问题描述】:
`
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
[SerializeField]
public float speed = 3.5f;
// Start is called before the first frame update
void Start()
{
transform.position = new Vector(63, 15, 51);
}
// Update is called once per frame
void Update()
{
float horizontalInput = Input.GetAxis("Horizontal");
transform.Translate(Vector3.right *horizontalInput *speed * Time.deltaTime);
}
}
`
我试着用谷歌搜索这个问题,我找到了解决方案,但我没有打错字,“Vector3”和 Time.deltaTime 也没有被突出显示
【问题讨论】:
标签: c# visual-studio unity3d