Merge pull request #9466 from JeffHund/master

Add CSharp code example for SetShaderParameter()
This commit is contained in:
Max Hilbrunner
2024-06-15 17:40:32 +02:00
committed by GitHub

View File

@@ -197,11 +197,18 @@ You can change uniforms from code using the function ``set_shader_parameter()``
which is called on the node's material resource. With a Sprite2D node, the
following code can be used to set the ``blue`` uniform.
::
.. tabs::
.. code-tab:: gdscript
var blue_value = 1.0
material.set_shader_parameter("blue", blue_value)
.. code-tab:: csharp
var blueValue = 1.0;
((ShaderMaterial)Material).SetShaderParameter("blue", blueValue);
Note that the name of the uniform is a string. The string must match exactly
with how it is written in the shader, including spelling and case.