Transform.position 位置


var position : Vector3

Description描述

The position of the transform in world space.

在世界空间坐标transform的位置。

  • C#

  • JavaScript

using UnityEngine;using System.Collections;public class example : MonoBehaviour {public void Awake() {transform.position = new Vector3(0, 0, 0);print(transform.position.x);}}
// Move the object to (0, 0, 0)//移动物体到(0, 0, 0)transform.position = Vector3(0, 0, 0);// Print the x component of the position to the Console//打印位置的x组件print(transform.position.x);


,