diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index f8243c4079e..a818fb50823 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -162,6 +162,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed null reference exception in Raytracing SSS volume component. - Fixed artifact appearing when diffuse and specular normal differ too much for eye shader with area lights - Fixed LightCluster debug view for ray tracing. +- Fixed issue with RAS build fail when LOD was missing a renderer ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs index 5a46e678b4a..71dd1126b1e 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs @@ -476,6 +476,7 @@ static void CheckSceneContentForRayTracing(MenuCommand menuCommand) // Flag that holds bool generalErrorFlag = false; var rendererArray = UnityEngine.GameObject.FindObjectsOfType(); + var lodGroupArray = UnityEngine.GameObject.FindObjectsOfType(); List materialArray = new List(32); ReflectionProbe reflectionProbe = new ReflectionProbe(); @@ -573,10 +574,31 @@ static void CheckSceneContentForRayTracing(MenuCommand menuCommand) if (!singleSided && hasSingleSided) { - Debug.LogWarning("The object " + currentRenderer.name + " has both double sided and single sided sub-meshes. The double sided flag will be ignored."); + Debug.LogWarning("The object " + currentRenderer.name + " has both double sided and single sided sub-meshes. All materials will be considered double-sided for ray-traced effects."); generalErrorFlag = true; } } + + //Check if one LOD is missing a renderer + for (var i = 0; i < lodGroupArray.Length; i++) + { + // Grab the current LOD group + LODGroup lodGroup = lodGroupArray[i]; + LOD[] lodArray = lodGroup.GetLODs(); + for (int lodIdx = 0; lodIdx < lodArray.Length; ++lodIdx) + { + + LOD currentLOD = lodArray[lodIdx]; + for (int rendererIdx = 0; rendererIdx < currentLOD.renderers.Length; ++rendererIdx) + { + if(currentLOD.renderers[rendererIdx] == null) + { + Debug.LogWarning("The LOD Group " + lodGroup.gameObject.name + " has at least one missing renderer in its children."); + generalErrorFlag = true; + } + } + } + } if (!generalErrorFlag) { diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs index 1a32a5ae97e..1eb9162e3a2 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs @@ -492,6 +492,8 @@ internal void BuildRayTracingAccelerationStructure(HDCamera hdCamera) for (int rendererIdx = 0; rendererIdx < currentLOD.renderers.Length; ++rendererIdx) { Renderer currentRenderer = currentLOD.renderers[rendererIdx]; + if(currentRenderer == null) continue; + // Add this fella to the renderer list // Unfortunately, we need to check that this renderer was not already pushed into the list (happens if the user uses the same mesh renderer // for two LODs)