Light 灯光

Inherits from Behaviour

Script interface for light components.

用于灯光组件的脚本接口。

Use this to control all aspects of Unity's lights. The properties are an exact match for the values shown in the Inspector.

使用这个控制Unity灯光的各个方面。这个属性完全匹配显示在检视面板中的值。

Usually lights are just created in the editor but sometimes you want to create a light from a script:

通常灯光是在编辑器中被创建,但是有时通过脚本创建灯光:

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Start() {
		GameObject lightGameObject = new GameObject("The Light");
		lightGameObject.AddComponent<Light>();
		lightGameObject.light.color = Color.blue;
		lightGameObject.transform.position = new Vector3(0, 5, 0);
	}
}
function Start () {
	// Make a game object
	//创建一个游戏物体
	var lightGameObject : GameObject = new GameObject("The Light");

	// Add the light component
	//添加灯光组件
	lightGameObject.AddComponent(Light);

	// Set color and position
	//设置颜色和位置
	lightGameObject.light.color = Color.blue;

	// Set the position (or any transform property) after
	// adding the light component.
	//设置位置(或任意变换属性)之后,添加灯光组件
	lightGameObject.transform.position = Vector3(0, 5, 0);
}

Variables变量

Inherited members继承成员

Inherited Variables继承变量

Inherited Functions继承函数

Inherited Class Functions继承类函数

Page last updated: 2011-3-30