unity 添加资源后运行出现如下报错

在添加了资源后报错,不影响运行,但是build的时候会失败。

img


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 <6f7cbd2409704976852490551564c873>:0)
UnityEngine.InternalStaticBatchingUtility.Combine (UnityEngine.GameObject staticBatchRoot, System.Boolean combineOnlyStatic, System.Boolean isEditorPostprocessScene, UnityEngine.InternalStaticBatchingUtility+StaticBatcherGOSorter sorter) (at <6f7cbd2409704976852490551564c873>:0)
UnityEditor.UnityBuildPostprocessor.OnProcessScene (UnityEngine.SceneManagement.Scene scene, UnityEditor.Build.Reporting.BuildReport report) (at :0)
UnityEditor.Build.BuildPipelineInterfaces+<>c__DisplayClass17_0.b__1 (UnityEditor.Build.IProcessSceneWithReport spp) (at :0)
UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List1[T] oneInterfaces, System.Action1[T] invocationOne, System.Collections.Generic.List1[T] twoInterfaces, System.Action1[T] invocationTwo, System.Boolean exitOnFailure) (at :0)
UnityEditor.Build.BuildPipelineInterfaces:OnSceneProcess(Scene, BuildReport)

在build的时候如下报错

img

将场景中的PostProcess相关的组件删掉,需要的话重新添加

应该是添加的资源有打包脚本,全局搜一下OnProcessScene这个方法,看一下处理逻辑,实在不会的话可以全部注释掉试试