Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Light.color

マニュアルに切り替える
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); } }