Description
The Set
method in the Material
class is used to assign a Vector4
value to a specified parameter within the material. This method is useful for dynamically changing material properties at runtime, such as colors, positions, or other vector-based attributes.
Usage
To use the Set
method, you need to provide the name of the parameter you wish to modify and the Vector4
value you want to assign to it. The method returns a Boolean
indicating whether the operation was successful.
Example usage:
Material myMaterial = Material.Load("path/to/material");
Vector4 newValue = new Vector4(1.0f, 0.5f, 0.25f, 1.0f);
bool success = myMaterial.Set("MyParameter", newValue);
if (success)
{
// The parameter was successfully set
}
else
{
// The parameter could not be set, possibly due to an invalid name
}
Example
Material myMaterial = Material.Load("path/to/material");
Vector4 newValue = new Vector4(1.0f, 0.5f, 0.25f, 1.0f);
bool success = myMaterial.Set("MyParameter", newValue);
if (success)
{
// The parameter was successfully set
}
else
{
// The parameter could not be set, possibly due to an invalid name
}