Skip to content

ShaderMaterial

Eduard Gushchin edited this page Jun 21, 2026 · 5 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.ShaderMaterial
Namespace Electron2D
Kind class
Category Rendering

Overview

Provides the Electron2D material resource backed by a custom Electron2D.ShaderMaterial.Shader.

Syntax

public sealed class Electron2D.ShaderMaterial : Electron2D.Material

Remarks

ShaderMaterial stores a shader resource and a case-sensitive map of shader parameter values. Electron2D 0.1.0 Preview supports scalar 2D uniforms and Electron2D.Texture2D sampler values.

Unsupported values are rejected when set. This prevents the renderer from silently replacing invalid parameters later in the frame.

Thread Safety

This type is not synchronized. Mutate shader material state on the main thread or from a single import/tooling worker.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Material
  • Electron2D.ShaderMaterial.Shader
  • Electron2D.Texture2D

Members

Member Kind Summary
Shader Property Gets or sets the shader program used by this material.
Electron2D.ShaderMaterial() Constructor Initializes a new instance of the ShaderMaterial type.
GetShaderParameter(Electron2D.StringName) Method Returns the current value set for a shader uniform parameter.
SetShaderParameter(Electron2D.StringName, Electron2D.Variant) Method Changes the value set for a shader uniform parameter.

Member Details

Shader

Kind: Property

public Electron2D.Shader Shader { get; set; }

Summary

Gets or sets the shader program used by this material.

Remarks

This property follows the validation and lifetime rules of its declaring type.

Value

The current shader value.

Thread Safety

This property is not synchronized. Mutate it on the main thread or from a single import/tooling worker.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ShaderMaterial

Electron2D.ShaderMaterial()

Kind: Constructor

public Electron2D.ShaderMaterial()

Summary

Initializes a new instance of the ShaderMaterial type.

Remarks

The new instance follows the lifetime and validation rules of its declaring type.

Thread Safety

This member is not synchronized. Call it from the thread that owns the related object unless the declaring type states otherwise.

Since

This API is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ShaderMaterial

GetShaderParameter(Electron2D.StringName)

Kind: Method

public Electron2D.Variant GetShaderParameter(Electron2D.StringName)(Electron2D.StringName param)

Summary

Returns the current value set for a shader uniform parameter.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • param: The exact case-sensitive parameter name.

Returns

The stored parameter value, or a nil Electron2D.Variant when no value is set for param.

Exceptions

  • System.ArgumentException: Thrown when param is empty.

Thread Safety

This method is not synchronized. Call it on the main thread or from a single import/tooling worker.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ShaderMaterial.SetShaderParameter(Electron2D.StringName,Electron2D.Variant)

SetShaderParameter(Electron2D.StringName, Electron2D.Variant)

Kind: Method

public System.Void SetShaderParameter(Electron2D.StringName, Electron2D.Variant)(Electron2D.StringName param, Electron2D.Variant value)

Summary

Changes the value set for a shader uniform parameter.

Remarks

In Electron2D 0.1.0 Preview the supported value subset is System.Boolean, integer values, floating-point values, Electron2D.Vector2, Electron2D.Color, Electron2D.Transform2D and Electron2D.Texture2D references.

Parameters

  • param: The exact case-sensitive parameter name.
  • value: The new value. A nil Electron2D.Variant removes the stored parameter value.

Exceptions

  • System.ArgumentException: Thrown when param is empty, uses a reserved canvas shader built-in name, or value is not a supported shader parameter value.

Thread Safety

This method is not synchronized. Call it on the main thread or from a single import/tooling worker.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ShaderMaterial.GetShaderParameter(Electron2D.StringName)

Clone this wiki locally