如何将此Unityscript转换为C#?[请忽略]

这是我在C#中的代码,这是怎么回事?:有人可以在此代码中找到错误吗?

using UnityEngine;
using System.Collections;

public class qwe : MonoBehaviour {

    void  Update (){
        float xP = Input.GetAxis ("Horizontal")*Time.deltaTime * 20; 
        transform.Translate(Vector3 xe = new Vector3(xP,0,0));
        transform.position.x = Mathf.Clamp (transform.position.x, -10, 10);
    }
}
罗万

用这个

using UnityEngine;
using System.Collections;

public class qwe : MonoBehaviour {

    void  Update (){
        float xP = Input.GetAxis ("Horizontal")*Time.deltaTime * 20;
        Vector3 xe = new Vector3(xP,0,0);
        transform.Translate(xe);
        float x = Mathf.Clamp (transform.position.x, -10, 10);
        transform.position = new Vector3(x,transform.position.y,transform.position.z);
    }
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章