Vector4.operator Vector2    运算符 二维向量


static implicit function Vector2 (v : Vector4) : Vector2

Description描述

Converts a Vector4 to a Vector2.

转换一个Vector4到Vector2。

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

Vector4可以隐式转换到Vector2(z和w被忽略)。

  • C#

  • JavaScript

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.//Shader向量总是Vector4,但该值这里被转换为Vector2var value : Vector2 = renderer.material.GetVector("_SomeVariable");}


,