Search Unity

Disable then Enable Object with ComputeShader breaks the shader... help!

Discussion in 'Shaders' started by RedVonix, Dec 15, 2017.

  1. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    422
    I'm using a ComputeShader for a visual effect - specifically the Cocuy effect, and posting here as I'm not able to get a response from the developer.

    I'm finding if I disable the object that the shader is attached to, then re-enable it, I get the following message spammed constantly...

    Code (csharp):
    1.  
    2. NullReferenceException: GetRef
    3. UnityEngine.ComputeShader.SetBuffer (Int32 kernelIndex, System.String name, UnityEngine.ComputeBuffer buffer) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/ComputeShaderBindings.gen.cs:129)
    4.  
    This is being caused by trying to set a buffer, at this line of code...
    Code (csharp):
    1.  
    2. m_particleAreaShader.SetBuffer(m_advectKernel, "_Obstacles", m_simulation.ObstaclesBuffer);
    3.  
    I've been trying to fix this for the past few hours and am losing what little hair I have left trying to do so. Any advice or tips would be extremely appreciated!

    Thank you so much!!!

    -Red
     
    Ash-Blue likes this.
  2. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    422
    We got it working. Found numerous bugs in the Cocuy code that caused problems. Got them fixed on our own.
     
  3. aki-kanerva

    aki-kanerva

    Joined:
    Jan 3, 2012
    Posts:
    1,398
    Hey @RedVonix, I'm having the exact same issue with Cocuy... could you maybe point me in the general direction of which bits of Cocuy code need fixing?