NullReferenceException: Object reference not set to an instance of an object. UnityEngine.Rendering.CoreUtils:CreateEngineMaterial(Shader) UnityEngine.Rendering.HighDefinition.HDRenderPipeline:.ctor(HDRenderPipelineAsset, HDRenderPipelineAsset) UnityEngine.Rendering.HighDefinition.HDRenderPipelineAsset:CreatePipeline() UnityEngine.Rendering.RenderPipelineAsset:InternalCreatePipeline() UnityEngine.Rendering.RenderPipelineManager:PrepareRenderPipeline(RenderPipelineAsset) UnityEngine.Rendering.RenderPipelineManager:DoRenderLoop_Internal(RenderPipelineAsset, IntPtr)
Unity2019.4.3 HDRP7.4.1
エディタでビルドした場合は正常です。つまりコマンドラインビルドで問題が起きてるようです(未検証
原因
HDRP build: Cannot create required material because shader is null
I’ve finished migrating my game from Unity 2018.3 to Unity 2019.1, with HDRP 5.13. The game builds, but when running it, it hangs on the splash screen. Looking ...
HDRenderPipelineResources.assetのResolveMotionVecPSの項目がNoneになってます!
m_MotionVectorResolve = CoreUtils.CreateEngineMaterial(asset.renderPipelineResources.shaders.resolveMotionVecPS);
そのためHDRenderPipeline.csのコンスタラクタの上記箇所でNullエラーになってしまいます。
対策
根本治癒
- HDRenderPipelineResources.assetをアセットをAssets以下に持ってきて正しい値を設定する
- C:\Users\???\AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.render-pipelines.high-definition@7.4.1 にある.assetを修正したもので上書き
package上書き
- LibraryPackageCacheのcom.unity.render-pipelines.high-definition@7.4.1をPackagesに移動
- HDRenderPipelineResources.assetを正しい値に設定する