Vector4.operator Vector2 运算符 二维向量

static implicit function Vector2 (v : Vector4) : Vector2


Converts a Vector4 to a Vector2.


Vector4s can be implicitly converted to Vector2 (z and w is discarded).


using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Start() {
		Vector2 value = renderer.material.GetVector("_SomeVariable");
function Start () {
	// Shader vectors are always Vector4s.
	// But the value here is converted to a Vector2.
	var value : Vector2 = renderer.material.GetVector("_SomeVariable");
Page last updated: 2011-9-18