NullPointer Exception when starting in editor twice

I have a custom render script, calling the render method. The first run after a compile it works perfect. After i restart in playmode, i got the following Nullpointer Exception. I have no statics in my own classes, so i guess its somehow something in the Render Pipeline itself? It worked fine with Unity 2021 where i updated from.

Using Unity 2022.2.14 with URP 14.0.7

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Rendering.VolumeManager.ReplaceData (UnityEngine.Rendering.VolumeStack stack) (at ./Library/PackageCache/com.unity.render-pipelines.core@14.0.7/Runtime/Volume/VolumeManager.cs:332)
UnityEngine.Rendering.VolumeManager.Update (UnityEngine.Rendering.VolumeStack stack, UnityEngine.Transform trigger, UnityEngine.LayerMask layerMask) (at ./Library/PackageCache/com.unity.render-pipelines.core@14.0.7/Runtime/Volume/VolumeManager.cs:436)
UnityEngine.Rendering.Universal.CameraExtensions.UpdateVolumeStack (UnityEngine.Camera camera, UnityEngine.Rendering.Universal.UniversalAdditionalCameraData cameraData) (at ./Library/PackageCache/com.unity.render-pipelines.universal@14.0.7/Runtime/UniversalAdditionalCameraData.cs:217)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.UpdateVolumeFramework (UnityEngine.Camera camera, UnityEngine.Rendering.Universal.UniversalAdditionalCameraData additionalCameraData) (at ./Library/PackageCache/com.unity.render-pipelines.universal@14.0.7/Runtime/UniversalRenderPipeline.cs:944)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderCameraStack (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera baseCamera) (at ./Library/PackageCache/com.unity.render-pipelines.universal@14.0.7/Runtime/UniversalRenderPipeline.cs:775)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, System.Collections.Generic.List`1[T] cameras) (at ./Library/PackageCache/com.unity.render-pipelines.universal@14.0.7/Runtime/UniversalRenderPipeline.cs:355)
UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, System.Collections.Generic.List`1[T] cameras) (at <8744f615ca0c450898baad3219003b45>:0)
UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, System.IntPtr loopPtr, UnityEngine.Object renderRequest, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety) (at <8744f615ca0c450898baad3219003b45>:0)
UnityEngine.Camera:Render(Camera)
BrightnessCalculator:Render(PerformanceTracker) (at Assets/Assemblies/Core/Environment/BrightnessCalculator.cs:116)

Getting this as well in 2022.2.13 and 2022.2.14, was fine in 2022.2.12

1 Like

I’m also having this problem with Unity 2022.2.15.
My workaround is to set Volume Update Mode as Every Frame instead of Via Scripting on the URP Render Settings asset.
Could you confirm if this workaround work for you too?

Edit:
Managed to reproduce this on a clean project and just filled up a bug report

  • With Unity Unity 2022.2.13 (or latter)
  • Start an URP Project (14.0.7)
  • Enable Editor [Enter Play Mode Options]
  • Set URP Render Settings Volume Update Mode to [Via Scripting]
  • Enable [Post Processing] on Camera component
  • Hit Play
  • Hit Stop
  • Hit Play again

Confirmed, thanks a lot. The camera that cause the exception was “Via Scripting”. Changed that to every frame like all other cameras fixed it.

Do you have a link to the bug or bug number?

Still happens in Unity 2022.2.16

Yeah, I kinda have one…

CASE IN-38523
https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-38523 (ping me if you want access)

But it got closed…
Really, no wonder why things doesn’t get fixed. This issue is 100% reproduceable with really simple steps and still got closed…

Guess what, there’s a project attached AND step-by-step instructions…

1 Like

Still happens in Unity 2022.2.17
I’ve re-opened the ticket asking for which information is missing.

3 Likes

I don’t have access to that ticket but still getting this in 2022.2.19

Also happening in 2021.3.27. I upgraded from 2020.3.48 and had that setting set to “via scripting” in the urp settings asset. Had a mini heart-attack when loading any new scene resulted in that error. Created a new Render Pipeline asset and everything worked just fine. But I’ve noticed that the “Advance” section in the pipeline asset that appeared in 2020 (with settings such as SRP Batcher, Dynamic Batching, Volume Update Mode, etc) is gone in 2021