![](/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.