UE3:Set the Material parameter

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 10:37, 17 March 2010 by Wormbo (talk | contribs) (moved Set the Material parameter to UE3:Set the Material parameter: UE3-specific)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

To set a Material's parameter from UnrealScript you will need either a MaterialInstanceConstant

()

or a MaterialInstanceTimeVarying

()

. If you only have aMaterial

()

, you will need to create a MaterialInstance for that first.

Once you have a MaterialInstance, you can use its Set*() functions to assign a value to any of the material's parameters, for example: <uscript> theMaterialInstance.SetTextureParameterValue('aTextureParameter', someTexture); theMaterialInstance.SetTextureParameterValue('aVectorParameter', FancyLinearColor); theMaterialInstance.SetTextureParameterValue('aScalarParameter', CoolEffectSpeed); </uscript> You can reset all parameters to their defaults by calling the MaterialInstance's ClearParameterValues() function.