how to pass custom variables to shaders

hello, how can i pass the position of a lightsource to a shader?

in the shader i already have this defined:

Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}    
    _LightPos ("LightPos", Vector) = (0,0,0,1)

but i dont know how to fill this LightPos variable from the application side.


You could use Material.SetVector:

renderer.material.SetVector("_LightPos", Vector4(0,0,0,1));