I have a surface shader which uses a vertex function. I want to change the value of one of my properties inside of the vertex function, however the value never changes. I do not want to change the value from c# script. Is there a way to accomplish this?
It’s somewhat confusing but the _Frequency defined in the properties section of a .shader and the _Frequency in the rest of the .shader aren’t the same thing. The properties section is used to define values the CPU side material definition should keep track of. When something is rendered with that material the CPU is telling the GPU to render the shader with a set of values, then lets the GPU do it’s own thing. The shader from that point is completely detached from the CPU and can’t communicate back in any direct way. The _Frequency variable being modified by the shader is only being changed for each unique execution of the shader code per frame, per vertex, and per pixel. What that means is the value is only stored for as long as each shader stage is executed, in short any changes to that value in the vertex shader won’t even be known by the pixel shader that runs after it let alone the CPU side material.
If you’re looking to do some kind of animation within a shader without having to set values manually from C# you have to use a value that’s being passed to a shader already like _Time.y or the transformed world position.
These are coming from the CPU still, but Unity is handling it on the native side of the engine code.