未将对象引用设置为对象 UnityEngine 的实例 [英] Object reference not set to an instance of an object UnityEngine

查看:54
本文介绍了未将对象引用设置为对象 UnityEngine 的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

长话短说,我在编写游戏代码时突然在 unity 中遇到了一堆这些错误(数字一直在上升)

Keep a long story short, ive suddenly gotten a bunch of these errors in unity when coding my game (The numbers keep going up)

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.UIElements.UIR.RenderChain.Render (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection)

这是我的一个更大项目的第一个模板,但我的对象脚本都没有引用与 UIElements 相关的任何内容......只是用于设置弹药计数器文本的 UI你们有什么想法吗?它不会影响我的游戏玩法或我的脚本,它只是在控制台中很烦人,而且当我不在游戏中时也会发生这种情况.我认为在撰写本文时,错误数量已达到 35 个谢谢!:D

Its my first template of a much larger project, but none of my objects' scripts reference anything to do with UIElements... just UI for setting the text of an ammo counter You guys got any ideas? it doesnt affect my gameplay or my scripts it just is annoying in the console, and it happens when im not in game too. I think the amount of errors has maxed out at 35, in the time of writing this Thanks! :D

推荐答案

您可以尝试删除项目的缓存文件夹library",这将使 Unity 重新导入您的所有资产并生成中间 DLL 的新副本.
警告:如果您的项目很大,重新导入所有资产需要很长时间.

You can try to delete the project's caching folder "library", this will make Unity reimport all your assets and generate new copies of intermediate DLLs.
Warning: It will take a long time to reimport all assets if your project is big.

这篇关于未将对象引用设置为对象 UnityEngine 的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆