C# 统一错误CS0103:名称';输入';在当前上下文中不存在
Heyy我正在学习Unity DevelopmentEngine,但是当我尝试将我的脚本与我的sprite关联时,我遇到了以下错误:Unity错误CS0103:当前上下文中不存在名称“input”,我的代码非常简单C# 统一错误CS0103:名称';输入';在当前上下文中不存在,c#,unity3d,C#,Unity3d,Heyy我正在学习Unity DevelopmentEngine,但是当我尝试将我的脚本与我的sprite关联时,我遇到了以下错误:Unity错误CS0103:当前上下文中不存在名称“input”,我的代码非常简单 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Playermovement : MonoBehaviour { public floa
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Playermovement : MonoBehaviour {
public float speed;
private Rigidbody2D myRigidbody;
private Vector2 change;
void Start() {
myRigidbody = GetComponent<Rigidbody2D>();
}
void Update() {
change = Vector2.zero;
change.x = Input.GetAxis("Horizontal");
change.y = input.GetAxis("Vertical");
Debug.Log(change);
}
}
使用系统集合;
使用System.Collections.Generic;
使用UnityEngine;
公共类玩家运动:单一行为{
公众浮标速度;
私人刚体;
私人矢量2变化;
void Start(){
myRigidbody=GetComponent();
}
无效更新(){
变化=矢量2.0;
change.x=Input.GetAxis(“水平”);
change.y=input.GetAxis(“垂直”);
Debug.Log(更改);
}
}
有人知道我的问题的答案吗?我愿意接受任何帮助,谢谢
我正在使用ItelliJ IDEA编辑我的C#脚本和Unity 2019.3.8f1个人
因为你使用input,而不是input
注意大写字母 您使用的
标记是c
,但代码是c#
I已更正。