用户工具

站点工具


侧边栏

script:unityengine:classes:light:light

Light 灯光

class in UnityEngine/Inherits from: Behaviour

Description 描述

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:

通常灯光仅在编辑器中创建但是有时你想在脚本中创建灯光:

JavaScript:

function Start () {
	// Make a game object
	var lightGameObject : GameObject = new GameObject("The Light");
 
	// Add the light component
	var lightComp = lightGameObject.AddComponent.<Light>();
 
	// Set color and position
	lightComp.color = Color.blue;
 
	// Set the position (or any transform property)
	lightGameObject.transform.position = Vector3(0, 5, 0);
}

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    void Start() {
        GameObject lightGameObject = new GameObject("The Light");
        Light lightComp = lightGameObject.AddComponent<Light>();
        lightComp.color = Color.blue;
        lightGameObject.transform.position = new Vector3(0, 5, 0);
    }
}

Variables 变量

alreadyLightmappedHas the light already been lightmapped.
是否已经烘培灯光贴图。
areaSizeThe size of the area light. Editor only.
灯光区域的大小。仅编辑器中。
bounceIntensityThe multiplier that defines the strength of the bounce lighting.
定义的反射光的强度的倍数。
colorThe color of the light.
灯光的颜色。
commandBufferCountNumber of command buffers set up on this light (Read Only).
在该光照上建立的命令缓存的数量(只读)。
cookieThe cookie texture projected by the light.
灯光的纹理蒙版投影。
cookieSizeThe size of a directional light's cookie.
平行光的蒙版的大小。
cullingMaskThis is used to light certain objects in the scene selectively.
该属性用于在场景中选择性的照亮某些对象。
flareThe flare asset to use for this light.
使用该光源的光晕资源。
intensityThe Intensity of a light is multiplied with the Light color.
光照强度与光照颜色相乘。
rangeThe range of the light.
光照的范围。
script/unityengine/classes/light/light.txt · 最后更改: 2016/08/02 05:30 (外部编辑)