Search Unity

Missing shader variants

Discussion in 'Shaders' started by mikejurka, May 21, 2020.

  1. mikejurka

    mikejurka

    Joined:
    Apr 15, 2020
    Posts:
    1
    Hi all,

    I'm building some materials at runtime in my Unity project, and I have (most of) the variants in a .shadervariants file.

    However, sometimes it happens that I hit a path where I create a material with a shader variant that I hadn't included in the .shadervariants file, and the model is rendered as black.

    1) Is there a way to detect that this happened? i.e. a way to detect, at runtime, that a particular shader variant was not found and that a fallback is being used.
    2) Is there a way to, at runtime, compile/create a shader variant which wasn't included at compile time for your project?

    Thanks!
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,028
    Hi!
    1) I'm not sure, but this information can be in the log file.
    2) No, this is not possible.