Adding vertex color support to unlit shader?

I’m using an unlit shader and need it to support vertex colors because I can´t use normal maps, bump maps, Baked Light (or any light for that matter) in my project, so I need to fake shadows with vertex colors. I can´t code Shaders. I tried to modify the shader for 2 days now and failed. Could someone explain what lines of code / what elements are needed so vertex colors are rendered?

I really appreciate any help you can provide.

The details depend on the shader you’re trying to modify but generally speaking, it works like this:

  • Add a field float4 color : COLOR; to the appdata struct. This makes the vertex color available to the vertex shader.
  • Add a field float4 color : COLOR; to the vertex-to-fragment (v2f) struct. You will use this field to pass the color from the vertex shader to the fragment shader.
  • In the vertex shader (vert), transfer the color from the appdata struct to the vertex-to-fragment struct, e.g. o.color = v.color;.
  • In the fragment shader, use the vertex color however you want. For example, you could multiply the final color with the vertex color: return whatTheShaderCurrentlyReturns * i.color;