c# - 命名空间“UnityEngine.Experimental”中不存在类型或命名空间名称“Input”
问题描述
我正在使用统一的新输入系统并收到此错误,我尝试了很多来修复它但找不到问题。请帮我。
错误:
Assets\Player01.cs(4,32): error CS0234: The type or namespace name 'Input' does not exist in the namespace 'UnityEngine.Experimental' (are you missing an assembly reference?)
完整脚本(C#):
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.Input;
public class Player01 : MonoBehaviour
{
public InputMaster controls;
void Awake ()
{
controls.Player01.Shoot.performed += _ => Shoot();
}
void Shoot ()
{
Debug.Log("We shot the sherif!");
}
private void OnEnable()
{
controls.Enable();
}
private void OnDisable()
{
controls.Disable();
}
}
解决方案
问题是没有UnityEngine.Experimental.Input
. 但是,它只说“‘输入’在命名空间‘UnityEngine.Experimental’中不存在”。“实验”确实存在,“输入”不存在。但是,“输入系统”可以。那就是您要寻找的那个,而不是“输入”。您应该将第一行更改为:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.InputSystem;
public class Player01 : MonoBehaviour
...
推荐阅读
- php - 动态显示产品报告的php代码
- python - (初学者)NLP:我正在尝试了解如何对文本中的单词进行分类以识别与某个主题相关的所有单词
- node.js - 我的节点 socket.io 连接在短时间不活动后自动断开
- sql - 按特定顺序对包含字母和数字的值列表进行排序
- java - 使用 PrintWriter 时已为此响应调用 getOutputStream()
- python - 使用 pandas 中的数据框,我如何附加一个只有某些列相同的数据框?
- python - 如果 A 列中的单元格为空,则修改 B 列中的单元格
- php - 如果值匹配则更新行 else 插入新行
- c# - How to compare a two Cursor objects?
- react-native-android - 在 React-Native Android 应用程序中使用 3rd Party AAR