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

スクリプト言語

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

Light.range

マニュアルに切り替える
public var range: float;

説明

ライトの大きさを設定する。

See Also: Light component.

// Pulse light's range between original range
// and half of the original one

var duration : float = 3.0; var originalRange : float;

var lt: Light;

function Start() { lt = GetComponent.<Light>(); originalRange = lt.range; }

function Update() { var amplitude : float = Mathf.PingPong(Time.time, duration); // Transform from 0..duration to 0.5..1 range. amplitude = amplitude / duration * 0.5 + 0.5; // Set light range. lt.range = originalRange * amplitude; }