Skip to content

Format

typescript
Material.SetVector(name, value)

class: Material

Description

Set the Vector value of a material based on the property name.

This method assigns the specified vector value to the material's property.

Parameters

param_nametypedescription
namestringThe name of the property.
valueVector4The Vector value.

Return

typedescription
void

Code Example

typescript
let material = Resources.Load<Material>(Material, "materialId");
material.SetVector("_Vector", new Vector4(1, 2, 3, 4));
let _Vec = material.GetVector("_Vector");
Debug.Log("_Vector: ", _Vec);