Vector2.this [int index] 操作索引


var this[index : int] : float

Description描述

Access the x or y component using [0] or [1] respectively.

使用[0]或者[1]分别访问组件x或者y组件。

  • C#

  • JavaScript

using UnityEngine;using System.Collections;public class example : MonoBehaviour {public Vector2 p;public void Awake() {p[1] = 5;}}
var p : Vector2;p[1] = 5; // the same as p.y = 5// 等同于p.y = 5


,