mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
Merge pull request #9466 from JeffHund/master
Add CSharp code example for SetShaderParameter()
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user