Visual Studio将无法识别统一模块

发布于 2025-02-12 03:12:46 字数 752 浏览 0 评论 0 原文

我是Unity的完整初学者,以及Visual Studio 2022。

我试图制作2D游戏,并且一直在遵循本教程, https://www.youtube.com/watch?v=7iywpzl9gkm 。在25:11,我们向我们展示了如何制作脚本来控制玩家运动。当我要使用Visual Studio代码时,defececode的Unity调试器被弃用,不再功能。

为了解决这个问题,我切换到Visual Studio2022。我安装了“以Unity”和“ .NET桌面开发”模块安装了“游戏开发”模块,并将默认外部编辑器设置为“ Unitity” nounity to Visual Studio 2022。我被另一种形式指示。

尽管如此,我遇到错误CS0246:找不到类型或名称名称'inputValue'(视频中的27:29,我使用Unity的“ player Input”模块)

库也没有点亮绿色,但是我不确定这只是我们之间的主题差异,但这是一个具有默认的黑暗模式的干净安装。

I am a complete beginner to Unity, as well as Visual Studio 2022.

I was trying to make a 2D game, and have been following along this tutorial, https://www.youtube.com/watch?v=7iYWpzL9GkM. At 25:11, we are shown how to make a script to control the player movement. While I was going to use Visual Studio Code, the Unity debugger for VScode is deprecated, and no longer functions.

To solve this I switched to Visual Studio 2022. I installed the 'Game Development with Unity' and the '.NET desktop development' modules, and set the default external editor within Unity to Visual Studio 2022. I also regenerated the .csproj files as I was instructed in another form.

Despite this, I encounter error CS0246: The type or namespace name 'InputValue' could not be found (27:29 in the video, I am using the 'Player Input' module from Unity)
enter image description here

The libraries also do not light up green, but I am not sure if that is just a theme difference between us, but this is a clean install with the default dark mode.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

靑春怀旧 2025-02-19 03:12:46

在视频中22:20 他们从视频中获取输入系统包软件包管理器。

错误CS0246:找不到类型或名称名称'InputValue'

是编译器,告诉您找不到定义InputValue的命名空间。

要解决此问题,您需要在文件顶部添加“使用”语句,以告诉编译器在哪里可以找到该功能。

using UnityEngine.InputSystem;

他们的代码也无法没有它,实际上您看到他们意识到了错误并也更正了错误。

At 22:20 in the video they get the Input System package from the Package Manager.

The documentation for InputValue says it's from the UnityEngine.InputSystem namespace, so when you see the error:

error CS0246: The type or namespace name 'InputValue' could not be found

It's the compiler telling you it can't find the namespace where InputValue is defined.

To solve this problem, you need to add a "using" statement at the top of the file to tell the compiler where to find that function.

using UnityEngine.InputSystem;

Their code won't work without it, either and actually at 31:50 in the same video you see them realize the error and correct it as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文