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

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:
    1,389
    Hi!
    1) I'm not sure, but this information can be in the log file.
    2) No, this is not possible.
     
unityunity