小编Stu*_*ent的帖子

将UnityScript转换为C#时出错

我试图将一些UnityScript代码转换为D#,我收到以下错误:

表达式表示的方法基团,其中一个variable,valuetype预期对Getcomponent

void  Update ()
{
    float xVel = GetComponent().Rigidbody2D().velocity.x;
    if( xVel < 18 && xVel > -18 && xVel !=0){
        if(xVel > 0){
            GetComponent.Rigidbody2D().velocity.x=20;   

        }else{
            GetComponent.Rigidbody2D().velocity.x = -20;

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

c# unity-game-engine unityscript

0
推荐指数
1
解决办法
95
查看次数

标签 统计

c# ×1

unity-game-engine ×1

unityscript ×1