NullReferenceException: Object reference not set to an instance of an object
UnityEngine.InternalStaticBatchingUtility.CombineGameObjects (UnityEngine.GameObject[] gos, UnityEngine.GameObject staticBatchRoot, System.Boolean isEditorPostprocessScene, UnityEngine.InternalStaticBatchingUtility+StaticBatcherGOSorter sorter) (at 、、
unity运行场景会输出如上log,经查发现该场景中勾选了静态合批的模型有mesh丢失

解决方案:将静态合批取消勾选或者将丢失的mesh解决之后能清掉上述报错
下面是筛出mesh丢失的代码
[MenuItem("检测mesh状态")]
public

文章描述了在Unity引擎中遇到NullReferenceException错误,特别是与静态合批(StaticBatching)相关的对象引用问题。解决方案包括取消静态合批选项或查找并修复丢失的Mesh。提供了一个检测场景中Mesh状态的代码片段,用于找出空的MeshFilter。
872

被折叠的 条评论
为什么被折叠?



