Material.GetVector 获取向量

function GetVector (propertyName : string) : Vector4

Description描述

Get a named vector value.

获得已命名颜色的向量值

Four component vectors and colors are the same in Unity shaders. GetVector does exactly the same as GetColor just the input data type is different (xyzw in the vector becomes rgba in the color).

在unity着色器中四维向量和颜色的结果是相同的。GetVector和GetColor的不同之处在于只是输入的数据类型不同 (xyzw 向量转换成 rgba 颜色)。

参见: SetColor , GetVector .

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		print(renderer.material.GetVector("_Color"));
	}
}
print(renderer.material.GetVector("_Color"));
Page last updated: 2011-1-22