c# - 无法将类型 bool 隐式转换为 unity Engine Animator PlayerPrefs
问题描述
cannot implicitly convert type bool to unity Engine Animator
所以我正在尝试使用播放器预制件制作我的动画之一,但我不断收到此错误
shopm.light1 = PlayerPrefs.GetInt("animation") == 2;
我也尝试过这样做,但我收到了相同的错误消息
shopm.light1 = PlayerPrefs.GetInt("animation", shopm.light1 ? 1 : 0);
解决方案
您需要提供更多数据才能获得完整的答案,但根据您的代码,我假设shopm是一个动画师,而light1是一个参数,所以检查一下,看看它是否有帮助:
shopm.SetBool("light1", PlayerPrefs.GetInt("animation") == 2);
推荐阅读
- wordpress - 无法验证非管理员用户
- python-3.x - 更新字典值的引用而不是更新字典值
- python - 如何修复 Matplotlib 图表中的 y 轴自动缩放偏移错误
- node.js - Application Insights 无法跟踪节点中间件中的请求
- java - 具有可递增变量的 Spring 自定义 @Query
- git - 如何在 xampp htdocs 中使用 Github
- linux - 如何使 2 个带有 sql server 和 dotnet app 的容器相互通信?
- javascript - 按 ID 操作元素
- java - 带有 @EnableAspectJAutoProxy 的 @Autowired 对象的 Spring NullPointerException
- python - 如何在解析 Json 文件中的数据时仅获取 Python 脚本中所需的列