Version: 2017.2
public Color color ;

説明

ライトのカラーを設定する。

光の強さを変更するにはライトの色の明るさを変更します。 ライトは常に照明を追加します。よって、黒い色のライトは光がまったくないのと同じです。 See Also: Light component.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Light lt; void Start() { lt = GetComponent<Light>(); } void Update() { lt.color -= Color.white / 2.0F * Time.deltaTime; } }

他の例:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public float duration = 1.0F; public Color color0 = Color.red; public Color color1 = Color.blue; public Light lt; void Start() { lt = GetComponent<Light>(); } void Update() { float t = Mathf.PingPong(Time.time, duration) / duration; lt.color = Color.Lerp(color0, color1, t); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961