Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 我一直试图让我的Unity 2D播放器移动,但看起来我在脚本中犯了一个错误,我可以';找不到_C#_Unity3d - Fatal编程技术网

C# 我一直试图让我的Unity 2D播放器移动,但看起来我在脚本中犯了一个错误,我可以';找不到

C# 我一直试图让我的Unity 2D播放器移动,但看起来我在脚本中犯了一个错误,我可以';找不到,c#,unity3d,C#,Unity3d,我试着让我的团结球员移动。我开发了一个2D游戏,并使用此脚本尝试移动: 使用系统集合; 使用System.Collections.Generic; 使用UnityEngine; 公共类玩家控制器:单行为{ 公众浮标速度; 私有刚体2d rb; 私有向量2移动速度; void Start(){ rb=GetComponent(); } 无效更新(){ Vector2.moveInput=新的Vector2(Input.GetAxis(“水平”)、Input.GetAxis(“垂直”); mov

我试着让我的团结球员移动。我开发了一个2D游戏,并使用此脚本尝试移动:



使用系统集合;
使用System.Collections.Generic;
使用UnityEngine;
公共类玩家控制器:单行为{
公众浮标速度;
私有刚体2d rb;
私有向量2移动速度;
void Start(){
rb=GetComponent();
}
无效更新(){
Vector2.moveInput=新的Vector2(Input.GetAxis(“水平”)、Input.GetAxis(“垂直”);
moveVelocity=moveInput.normalized*速度;
}
void FixedUpdate(){
rb.移动位置(rb.位置+移动速度*时间固定时间);
}
}

当我想要打开unity时,总会有这样的错误:

Assets\PlayerController.cs(19,13):错误CS0117:“Vector2”不包含“moveInput”的定义

Assets\PlayerController.cs(20,20):错误CS0103:名称“moveInput”在当前上下文中不存在


我希望我能得到一些答案!谢谢大家!

Vector2
moveInput
之间放置一个句点

原件:

Vector2.moveInput...
固定的:

Vector2 moveInput...
调用
Vector2.moveInput
假定类
Vector2
有一个名为
moveInput
的静态变量

Vector2 moveInput...