Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Problem adding shader variants with GrabPass

Discussion in 'General Graphics' started by mrbenn, Nov 9, 2016.

  1. mrbenn

    mrbenn

    Joined:
    May 1, 2015
    Posts:
    13
    I'm trying to add a shader which uses GrabPass to a shader variant collection, but I get an error when attempting to add a variant. Im just using the example shader from https://docs.unity3d.com/Manual/SL-GrabPass.html. Anyone got any ideas on how to fix this, or is it an actual bug?

    ArgumentException: shader GrabPassInvert pass type 0 does not have a shader snippet
    UnityEngine.ShaderVariantCollection+ShaderVariant..ctor (UnityEngine.Shader shader, PassType passType, System.String[] keywords) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/ShaderBindings.gen.cs:525)
    UnityEditor.AddShaderVariantWindow.Draw (Rect windowRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/ShaderVariantCollectionInspector.cs:397)
    UnityEditor.AddShaderVariantWindow.OnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/ShaderVariantCollectionInspector.cs:261)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:187)
    UnityEditor.HostView.Invoke (System.String methodName) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:180)
    UnityEditor.HostView.OnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:76)
     
  2. Jhon_JQ

    Jhon_JQ

    Joined:
    Jul 24, 2018
    Posts:
    5
    how fixed it?
     
  3. sschoellhammer

    sschoellhammer

    Joined:
    Feb 15, 2013
    Posts:
    46
    I have the same problem. Unity 2019.4 LTS

    So shaders using grabpass are not supported in ShaderVariantCollections?

    For me this is part of the bigger problem of shader variants that are used in materials within asset bundles are being stripped, if they are not in a variant collection. So, this is all very annoying)
     
    Last edited: Jul 17, 2020
  4. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    Hi!
    Which pass are you trying to add?
    Does this happen when you add GrabPass, or when you're adding any pass from a shader that has a grab pass?
     
  5. sschoellhammer

    sschoellhammer

    Joined:
    Feb 15, 2013
    Posts:
    46
    Hi @aleksandrk , this is when adding a shader that is using grabpass. (As the initial poster writes, the example grabpass shader does not work)
     
  6. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
  7. sschoellhammer

    sschoellhammer

    Joined:
    Feb 15, 2013
    Posts:
    46
    Amazing :) Thanks so much!
     
  8. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    Hey, I reproduced this issue, will post here when an issue tracker link is available. The case # is 1264467.
     
  9. sschoellhammer

    sschoellhammer

    Joined:
    Feb 15, 2013
    Posts:
    46
    You're a star! Thanks!
     
  10. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
  11. sschoellhammer

    sschoellhammer

    Joined:
    Feb 15, 2013
    Posts:
    46