【问题标题】:error CS0246: The type or namespace name 'Player' could not be found (are you missing a using directive or an assembly reference?) Unity [closed]错误 CS0246:找不到类型或命名空间名称“Player”(您是否缺少 using 指令或程序集引用?) Unity [关闭]
【发布时间】:2022-01-20 17:07:06
【问题描述】:

我在处理这条消息时遇到了问题:

错误 CS0246:找不到类型或命名空间名称“Player” (您是否缺少 using 指令或程序集引用?

)

这是我的状态机:

【问题讨论】:

  • 看起来Player 类不存在。
  • @RawCake:查看 Player 的定义位置并添加适当的 using 指令。
  • 你有这样一个叫Player的组件吗?还是应该只是GameObject player
  • 请将您的代码作为文本添加到您的问题中(并注意code formatting)。有many good reasons,为什么代码图像不是一个好主意。最重要的原因:我们无法将图像中的代码复制到我们的环境中进行测试和改进,这使得帮助您变得更加困难。
  • 仅仅因为你调用了一个游戏对象 Player 并不意味着你可以在代码中引用它。

标签: c# unity3d


【解决方案1】:

您的播放器类型是GameObject。玩家只是名字。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-12-02
    • 1970-01-01
    • 1970-01-01
    • 2021-08-20
    • 2020-02-19
    • 1970-01-01
    • 2022-06-15
    • 2020-08-29
    相关资源
    最近更新 更多