Post Process Stack NullRefferenceException

worked thanks

100% working solution (2021.3.0f1)

faced the same issue, you can select camera post-process layer then switch to debug mode in the inspector and assign ref to resources by hands

5 Likes

Hi,
Solution, in my case I had imported a package from my other project, the camera came with Post-processing, and when installing the post-processing again, there was an error, which was already mentioned in the question, the solution was, eliminate the post-processing of the camera that came in the package that I had imported, and put the post-processing back on the camera, Note; the only drawback is to reconfigure the post-processing to the camera again. I hope it helps you

I’m bringing back this post, because none of the mentioned solutions seems to work on my case.
Premise: in Editor I don’t have any errors, the errors are only in build, specifically on the Player-log.
The thing is: the game works well, the post-process is working, but I still get an error log on the Player-log, which: 1) I guess slow down a bit the FPS, 2) creates a HUGE Player-log, especially after sometime you play (i.e. for 30 minutes playtime, it can get up to 100MB).

Here the error:

NullReferenceException: Object reference not set to an instance of an object
  at UnityEngine.Rendering.PostProcessing.AmbientOcclusion.IsEnabledAndSupported (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) [0x00096] in <641c028490bc4da9993fcb2aeea9578d>:0
  at UnityEngine.Rendering.PostProcessing.PostProcessLayer.SetLegacyCameraFlags (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) [0x00024] in <641c028490bc4da9993fcb2aeea9578d>:0
  at UnityEngine.Rendering.PostProcessing.PostProcessLayer.SetupContext (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) [0x000aa] in <641c028490bc4da9993fcb2aeea9578d>:0
  at UnityEngine.Rendering.PostProcessing.PostProcessLayer.BuildCommandBuffers () [0x00095] in <641c028490bc4da9993fcb2aeea9578d>:0
  at UnityEngine.Rendering.PostProcessing.PostProcessLayer.OnPreCull () [0x001f5] in <641c028490bc4da9993fcb2aeea9578d>:0
UnityEngine.Camera:Render()
PlanarReflections4.PlanarReflectionRenderer:RenderLegacyReflection(Camera)
UnityEngine.Camera:FireOnPreCull(Camera)

So, gameplay is not affected (besides maybe the FPS), but I get that huge Player.log.
I’m using Unity 2021.1.3f1. Post Processing Package 3.2.0.

I’ve tried the solutions listed above:

  • remove and re-apply postprocess volume and postprocess layer.
  • double check in the inspector - Debug mode if the PostProcessResources is correctly attached to the postprocess layer Resources.

Note: apparently in the package manager where I’ve installed the Post Processing Package 3.2.0 it says ā€œRecommended 3.1.1ā€, and it suggests to ā€œupdateā€ to version 3.1.1 (which is not an actual update). Is this due to a more stable version of the Post Processing Package? I wanted to try now v3.1.1 but I cannot access the Package Manager due to some issues with https://api.unity.com/v1/oauth2/authorize (feels like it’s offline). But I’m not sure it’ll fix my issues…

Any hints are very welcome.

EDIT: the service came back online, so I ā€œupdatedā€ the Post Processing Package to 3.1.1 but I’ve the exactly same issue as before.

Sorry for the bump… but really can’t find a way out.

My issue came the same way:

I installed a package and it wanted to use PostProcess.
I installed the PostProcess package.

…now those flooding errors coming…

I just reopened the scene without any further tricks or restarting Unity.
Post process works, errors nowhere.

Still having these issues in 2023 with v3.2.2
It eventually stopped spamming after restarting unity, deleting the camera and re-creating it…

… but then adding render textures broke it again.

I don’t really have the energy to tackle bugs in all the low quality poorly tested packages unity is pumping out, so thankfully old V1 post processing stack still works if you’re having this issue. Not ideal, might not be right for you, but I just need a few frames.

Reset ā€œPost-process Layerā€ component in inspector

07/22/2024 Still the best solution. Kudos.