How to access shader material value

How to i most simply change shader Value using C#?
5105822--503666--shader.jpg
Any help is appreciated, thanks

See that gear icon in the top right corner? Click it, and choose “Select Shader”. That will show you the internal names of the properties used by the shader. For example, maybe hopefully you’ll see a property named “_screenKoef” there, but just be aware that the author of the shader might have given it a different name in the inspector than what is used in the shader. If it’s not clear, you can also use that gear icon to “Edit Shader” and look at the underlying code.

Ultimately, you want to know the name of the property you’re trying to change. When you do, and assuming you have the renderer using this material, getting and setting shader values is pretty simple. Something like this:

public Renderer TheRenderer;
Material _theMaterial;

void Start() {
    _theMaterial = TheRenderer.material;
}

private void SetShaderValue() {
    _theMaterial.SetFloat("_SomeFloatParam", 1.23f);
    _theMaterial.SetColor("_SomeColorParam", Color.red);
}

Usually you’d cache the material in the Start method. Then, you can set various “Set*” methods on the material to set the shader values. There’s a different Set* (and corresponding Get*) for each data type.

Things are just slightly more complex if the render has multiple materials, in which case you’d need to access the renderer’s materials' array instead of the material’ property.

hi . please how can i acces the render material array to change the values please ?
thanks

It’s just renderer.materials: https://docs.unity3d.com/ScriptReference/Renderer.html

Note, though, that typically you make a copy of the existing materials to a local variable, then adjust the materials in that local array, then assign the local array back to the renderer. You’ll see some stuff like that here: https://answers.unity.com/questions/1010797/directly-assigning-material-through-renderermateri.html