Class MaterialExtensions
Provides extension methods for configuring materials used by Gamelogic Fx effects. These helpers simplify setting keyword collections, texture tiling, color lists, and kernel parameters in a consistent and centralized way.
public static class MaterialExtensions
- Inheritance
-
MaterialExtensions
- Inherited Members
Methods
Set(Material, IEnumerable<Keyword>)
Enables or disables shader keywords on the material according to the values in the provided keyword collection.
public static void Set(this Material material, IEnumerable<Keyword> keywords)
Parameters
materialMaterialThe material to modify.
keywordsIEnumerable<Keyword>The set of keywords to apply.
SetIntegerUniversal(Material, int, int)
Sets an integer shader property on the material using the appropriate API depending on the Unity version.
public static void SetIntegerUniversal(this Material material, int shaderPropertyId, int value)
Parameters
materialMaterialThe material to modify.
shaderPropertyIdintThe integer ID of the shader property.
valueintThe integer value to assign to the shader property.
SetIntegerUniversal(Material, string, int)
Sets an integer shader property on the material using its property name. Automatically resolves the property ID and routes the call to the universal setter.
public static void SetIntegerUniversal(this Material material, string propertyName, int value)
Parameters
materialMaterialThe material to modify.
propertyNamestringThe name of the shader property.
valueintThe integer value to assign to the shader property.
SetKeywordOfGroup(Material, string, string[])
Sets the specified keyword as enabled on the material, while disabling all other keywords in the same group.
public static void SetKeywordOfGroup(this Material material, string enabledKeyword, string[] keywordGroup)
Parameters
materialMaterialThe material to modify.
enabledKeywordstringThe keyword to enable on the material.
keywordGroupstring[]The group of keywords that are mutually exclusive, where only one can be enabled at a time. The enabledKeyword must be part of this group.
SetTextureTiling(Material, string, TextureTiling)
Sets a texture and its associated tiling parameters on the material.
public static void SetTextureTiling(this Material material, string textureName, TextureTiling textureTiling)