Search Unity

Question Only instancing constant buffers can have struct variables

Discussion in 'Shaders' started by Zilk, Dec 22, 2022.

  1. Zilk

    Zilk

    Joined:
    May 10, 2014
    Posts:
    333
    I have a custom shader that spits out a error and I can't really figure out why.

    Fragment program 'Fragment': struct variable 'UnityPerMaterial' is ignored. only instancing constant buffers can have struct variables.

    In build the depth and shadow passes seem to render but not the regular pass. So objects with the shaders cast shadows and render into the depth pass (get AO from them) but nothing more.

    Including the shader.
     

    Attached Files:

  2. randomcats

    randomcats

    Joined:
    Oct 27, 2023
    Posts:
    1
    Hi, I've encounterd a similar issue whereas a CBuffer is recognized as a struct variable by Unity's shader compiler. Have you figured out the cause & solution?