Gizmos.color 颜色

static var color : Color

Description描述

Sets the color for the gizmos that will be drawn next.

为随后绘制的gizmos设置颜色。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnDrawGizmosSelected() {
		Gizmos.color = Color.red;
		Vector3 direction = transform.TransformDirection(Vector3.forward) * 5;
		Gizmos.DrawRay(transform.position, direction);
	}
}
function OnDrawGizmosSelected () {
	// Draws a 5 meter long red line in front of the object
	//在物体的前面绘制一个5米长红色的线
	Gizmos.color = Color.red;
	var direction : Vector3 = transform.TransformDirection (Vector3.forward) * 5;
	Gizmos.DrawRay (transform.position, direction);
}
Page last updated: 2010-12-25