Vector4.operator Vector3 Manual     Reference     Scripting  
Scripting > Runtime Classes > Vector4
Vector4.operator Vector3

static implicit function Vector3 (v : Vector4) : Vector3

Description

Converts a Vector4 to a Vector3.

Vector4s can be implicitly converted to Vector3 (w is discarded).

JavaScripts
function Start () {
// Shader vectors are always Vector4s.
// But the value here is converted to a Vector3.
var value : Vector3 = renderer.material.GetVector("_SomeVariable");
}

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
void Start() {
Vector3 value = renderer.material.GetVector("_SomeVariable");
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

def Start():
value as Vector3 = renderer.material.GetVector('_SomeVariable')