![](/img/trans.png)
[英]Unity C# error: (12,47): error CS1503: Argument 2: cannot convert from 'System.Collections.Generic.List<UnityEngine.GameObject>' to 'float'
[英](Unity3D) error CS1503: Argument 2: cannot convert from 'float' to 'UnityEngine.Space'
我正在尝试统一学习 c#,当我按照有关使用鼠标查看和移动的旧教程进行操作时,出现此错误。 从那时起,Unity 似乎有了很大的更新。 我想无论如何我都可以尝试学习c代码。 有什么简单的方法可以让它工作吗? 我正在尝试以第一人称视角移动球。
using UnityEngine;
public class Motion : MonoBehaviour
{
public float speedx = .1f;
void Update()
{
float movement = Input.GetAxis ("Vertical");
movement *= Time.deltaTime;
this.transform.Translate
(Vector3.forward, movement);
float xDirection = Input.GetAxis("Horizontal");
Vector3 moveDirection = new Vector3(xDirection, 0.1f, movement);
transform.position += moveDirection * speedx;
}
}
(Vector3.forward , motion) 应该是 (Vector3.forward * movement)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.