用户工具

站点工具


侧边栏



Unity3D中文文档

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.
光照的范围。
renderModeHow to render the light.
如何渲染灯光。
shadowBiasShadow mapping constant bias.
阴影贴图偏移常量。
shadowNearPlaneNear plane value to use for shadow frustums.
靠近的平面值用于阴影截面。
shadowNormalBiasShadow mapping normal-based bias.
阴影图形基于正常的偏移。
shadowsHow this light casts shadows
该灯光投影阴影。
shadowStrengthStrength of light's shadows.
灯光阴影强度。
spotAngleThe angle of the light's spotlight cone in degrees.
聚光灯的圆锥形光照角度单位度。
typeThe type of the light.
光源类型。

Public Functions 公共函数

AddCommandBufferAdd a command buffer to be executed at a specified place.
在指定位置执行添加命令缓存。
GetCommandBuffersGet command buffers to be executed at a specified place.
在指定地方执行获取命令缓存。
RemoveAllCommandBuffersRemove all command buffers set on this light.
在该光照中设置移除所有命令缓存。
RemoveCommandBufferRemove com
script/unityengine/classes/light/light.txt · 最后更改: 2016/08/02 05:30 (外部编辑)