Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Adding Post-Processing Stack at runtime

Discussion in 'Image Effects' started by Slaktus, Mar 15, 2018.

  1. Slaktus

    Slaktus

    Joined:
    Dec 5, 2012
    Posts:
    58
    Hey, trying to add the PostProcessingLayer component to a camera at runtime (5.6.4p1, obtained via Nintendo Dev Interface) and get following error:
    The problem seems to be that the PostProcessRenderContext is not initialized correctly. How can I force this?

    Also curious why there is a difference between adding the component at runtime via a script and via the Add Component inspector menu. Adding the component via inspector menu works fine, but adding it by script does not.
     
  2. Slaktus

    Slaktus

    Joined:
    Dec 5, 2012
    Posts:
    58
    Nevermind, turns out updating to latest release of post-processing stack changed everything and solved the problem
     
  3. mokhabadi

    mokhabadi

    Joined:
    Jul 25, 2018
    Posts:
    27
    i have exactly same problem in 2019.3.3f1 with newest post process package!!!
     
  4. mokhabadi

    mokhabadi

    Joined:
    Jul 25, 2018
    Posts:
    27
    by adding post process layer in Awake instead of Start, Problem get solved (only when you start scene, otherwise it throw error)
     
    Last edited: Mar 24, 2020
  5. AwesomeAlexx

    AwesomeAlexx

    Joined:
    Jan 30, 2016
    Posts:
    18
    Can you explain me a bit more your process, I have an error, a null reference exception and didn't found out to solved this.


    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.Rendering.PostProcessing.AmbientOcclusion.IsEnabledAndSupported (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) (at Library/PackageCache/com.unity.postprocessing@2.3.0/PostProcessing/Runtime/Effects/AmbientOcclusion.cs:182)
    UnityEngine.Rendering.PostProcessing.PostProcessLayer.SetLegacyCameraFlags (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) (at Library/PackageCache/com.unity.postprocessing@2.3.0/PostProcessing/Runtime/PostProcessLayer.cs:771)
    UnityEngine.Rendering.PostProcessing.PostProcessLayer.SetupContext (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) (at Library/PackageCache/com.unity.postprocessing@2.3.0/PostProcessing/Runtime/PostProcessLayer.cs:863)
    UnityEngine.Rendering.PostProcessing.PostProcessLayer.BuildCommandBuffers () (at Library/PackageCache/com.unity.postprocessing@2.3.0/PostProcessing/Runtime/PostProcessLayer.cs:533)
    UnityEngine.Rendering.PostProcessing.PostProcessLayer.OnPreCull () (at Library/PackageCache/com.unity.postprocessing@2.3.0/PostProcessing/Runtime/PostProcessLayer.cs:462)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  6. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,655
    Still an issue.
     
  7. JFremaux

    JFremaux

    Joined:
    Feb 26, 2019
    Posts:
    1
    Still