Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

【SRP Batcher】How to make a Default Unlit Shader compatible?

Discussion in 'Getting Started' started by Deleted User, Apr 27, 2020.

  1. Deleted User

    Deleted User

    Guest

    In order to use SRP Batcher, I'm trying to learn to make a shader compatible.Here is what I have done:
    1. create a default Unlit shader (created by unity asset menu)
    2.declare property in CBUFFER:
    Code (csharp):
    1. CBUFFER_START(UnityPerMaterial)
    2.     fixed4 _Color;
    3. CBUFFER_END
    3.In the inspector ,it still reminds me that the shader is not compatible because "Material property is found in another cbuffer than "UnityPerMaterial(_Color)" "
    What Confused me is that this actually works in Windows(the shader became compatible after doing the same operations above), while in MacOS, the shader just can't make it. Then I tried to remove the property "_Color ", and I got another hint : "Builtin property found in another cbuffer than "UnityPerDraw"(unity_ObjectToWorld) ".This is wired because in the default shader ,"UnityCG.cginc" is included, and these builtin properties are already defined in a CBUFFER block in UnityShaderVariables.cginc.
    Why it acts so different between Windows and MacOS, is it because of the graphics API or some other reasons? Why the Shader is still not compatible while the properties already are declared in CBUFFER block in UnityShaderVariables.cginc and she shader seems includes this cginc file.