Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Post Process Stack NullRefferenceException

Discussion in 'Editor & General Support' started by theonciest, Mar 20, 2019.

  1. theonciest

    theonciest

    Joined:
    Jan 22, 2017
    Posts:
    12
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEngine.Rendering.PostProcessing.AmbientOcclusion.IsEnabledAndSupported (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) (at Library/PackageCache/com.unity.postprocessing@2.1.3/PostProcessing/Runtime/Effects/AmbientOcclusion.cs:179)
    3. UnityEngine.Rendering.PostProcessing.PostProcessLayer.SetLegacyCameraFlags (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) (at Library/PackageCache/com.unity.postprocessing@2.1.3/PostProcessing/Runtime/PostProcessLayer.cs:696)
    4. UnityEngine.Rendering.PostProcessing.PostProcessLayer.SetupContext (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) (at Library/PackageCache/com.unity.postprocessing@2.1.3/PostProcessing/Runtime/PostProcessLayer.cs:781)
    5. UnityEngine.Rendering.PostProcessing.PostProcessLayer.BuildCommandBuffers () (at Library/PackageCache/com.unity.postprocessing@2.1.3/PostProcessing/Runtime/PostProcessLayer.cs:468)
    6. UnityEngine.Rendering.PostProcessing.PostProcessLayer.OnPreCull () (at Library/PackageCache/com.unity.postprocessing@2.1.3/PostProcessing/Runtime/PostProcessLayer.cs:402)
    7.  
    We keep getting this error pinging off over and over it goes between that and Suimono - Water System.

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Suimono.Core.SuimonoModule.LateUpdate () (at Assets/SUIMONO - WATER SYSTEM 2/SCRIPTS/SuimonoModule.cs:704)
    3.  
    We keep trying to import Post Processing but sometimes it works, and sometimes it just doesn't show up in the viewport. We keep fixing stuff, and then this breaks, we fix this, then more things break, and then this breaks. But this error keeps occuring. Not just Suimono

    Thanks
     
  2. theonciest

    theonciest

    Joined:
    Jan 22, 2017
    Posts:
    12
    Also when it does work, it won't push through source tree to make it work. Always have to reinstall the package via window - package manager - post processing 2.1.3

    2.1.4 doesn't work for some reason.
     
  3. theonciest

    theonciest

    Joined:
    Jan 22, 2017
    Posts:
    12
  4. theonciest

    theonciest

    Joined:
    Jan 22, 2017
    Posts:
    12
  5. MisterZhou

    MisterZhou

    Joined:
    Nov 9, 2013
    Posts:
    6
    I have the same problem.
     
  6. theonciest

    theonciest

    Joined:
    Jan 22, 2017
    Posts:
    12
    conspiracy I tell you lol
     
  7. Albarnie

    Albarnie

    Joined:
    Oct 24, 2015
    Posts:
    12
    Bump. I just got the same issue
     
  8. PixelJ

    PixelJ

    Unity Technologies

    Joined:
    Nov 1, 2018
    Posts:
    179
    Same here.
     
  9. YondernautsGames

    YondernautsGames

    Joined:
    Nov 24, 2014
    Posts:
    177
    Is this error immediately after importing the package, and then if entering play mode after importing the package?

    If it's the same bug that I was seeing then I submitted a bug report for this a while back that has now been reprod and is in the system (case 1171701).

    In my case it seemed to be that there is a hidden field in the PostProcessingLayer component on cameras, called "Resource" or something like that which is set when the object is imported or created. If the component shows as "missing script" because the package isn't installed, then installing the package doesn't correctly initialise that property and it spams errors to the console.

    The simplest way to resolve it is by restarting the editor after installing the post processing package. You can also try and ensure that any PostProcessingLayer components are disabled before the package is installed and then re-enabled after, though this might be a pain depending on your workflow. Hopefully it gets fixed soon.

    If this is a different error then apologies. Let me know and I'll remove this reply
     
  10. SteenPetersen

    SteenPetersen

    Joined:
    Mar 13, 2016
    Posts:
    30
  11. mokhabadi

    mokhabadi

    Joined:
    Jul 25, 2018
    Posts:
    8
    I finally found the solution:

    Code (CSharp):
    1.  
    2. using UnityEngine.Rendering.PostProcessing;
    3. public PostProcessResources postProcessResources;
    4. void Start()
    5. {
    6.         PostProcessLayer postProcessLayer = Camera.main.gameObject.AddComponent<PostProcessLayer>();
    7.         postProcessLayer.Init(postProcessResources);
    8.         postProcessLayer.volumeTrigger = Camera.main.transform;
    9.         postProcessLayer.volumeLayer = LayerMask.GetMask("YourLayer");
    10. }
    11.  
    then find "postProcessResources" in assets and set its reference.

    in short, you must "init" it yourself. it can't find postProcessResources.
     
    sama-van likes this.
  12. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,601
    Working a charm thanks!!
     
  13. ThomRobinGames

    ThomRobinGames

    Joined:
    May 20, 2020
    Posts:
    1
    In case you're like me and are not sure where Post-Process Resources is, it's in
    Packages->
    Post Processing->
    PostProcessing
     
unityunity