Vector3.this [int index] 操作索引

var this[index : int] : float

Description描述

Access the x, y, z components using [0], [1], [2] respectively.

使用[0], [1], [2]分别访问组件x, y, z组件。简单来说就是用索引号代替x, y, z组件。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public Vector3 p;
	public void Awake() {
		p[1] = 5;
	}
}
var p : Vector3;
//等同于p.y = 5
p[1] = 5; 
Page last updated: 2010-12-19