Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

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

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

  1. EminemJ


    Mar 10, 2020
    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.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.