Browse Source

Add CSharp code example for SetShaderParameter()

Jeff 1 year ago
parent
commit
0ba9658f1f
1 changed files with 8 additions and 1 deletions
  1. 8 1
      tutorials/shaders/your_first_shader/your_first_2d_shader.rst

+ 8 - 1
tutorials/shaders/your_first_shader/your_first_2d_shader.rst

@@ -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.