Skip to content

PointLight Component ​

位置から全方向へ広がる照明を設定します。

設定する手順 ​

  1. 位置・色・強さ・半径と減衰を設定します。
  2. SceneViewまたはGameViewで結果を確認します。
  3. 編集中のSceneまたはPrefabを保存します。

項目の説明 ​

項目C#名型操作定義時の初期値意味
色ColorColor4読取・変更Color4::White()色を指定します。RGBAではAlphaも持ちます。
強度Intensityfloat読取・変更1.0f光や効果の強度倍率です。
半径Radiusfloat読取・変更8.0f形状または効果の半径です。
減衰Decayfloat読取・変更1.0f距離に応じた減衰の強さです。
影の強さShadowStrengthfloat読取・変更0.92f影による減光の強さです。0で影の影響がなくなります。
光源半径ShadowRadiusfloat読取・変更0.05f光源の半径です。影のぼけ方に影響します。
有効Enabledbool読取・変更trueこのComponentの処理を有効にします。GameObject全体のアクティブ状態とは別です。

Inspectorの設定と使い方 ​

「Editor / C#」は両方から変更できる設定、「Editorのみ」は公開C# APIのない編集操作です。「Editor表示のみ」は計算結果や統計などの確認欄です。「C#のみ」は、このInspectorに編集欄のない操作です。

設定・操作編集場所C#の入口意味・使い方
色・強度・有効・位置Editor / C#Color / Intensity / EnabledTransformの位置から周囲へ広がる光です。壁灯・爆発・アイテムの点滅などに使います。位置を動かすときはTransformを変更します。
半径・減衰・光源半径・影Editor / C#Radius / Decay / ShadowRadius / ShadowStrengthRadiusは照らす範囲、Decayは弱まり方、ShadowRadiusは影計算での光源の大きさです。光源半径を変えることと照射範囲を広げることは異なります。

初期値はEngineのComponent定義時の値で、C++表記を含みます。C#へ貼り付ける実行例ではありません。既存Sceneの保存値や既定Assetがある場合はそちらが優先されます。数値の編集範囲はInspectorで制限される場合があります。

C#から使う ​

操作型はPointLightです。 GameObjectから取得する基本操作はGameObjectの操作を参照してください。以下には基本プロパティだけでなく、公開関数・追加の設定API・継承した共通操作も掲載します。

実用例:ランプの明るさを周期的に変える ​

PointLightと同じGameObjectへ追加します。照射範囲はEditorで設定し、ここでは強度だけを時間で変えます。

cs
using NEMEngine;

public sealed class PulsingLight : MonoBehaviour {

    [SerializeField, Min(0.0f)] private float baseIntensity = 10.0f;
    [SerializeField, Min(0.0f)] private float speed = 2.0f;
    private PointLight? light;

    void Start() {
        // 位置や照射範囲はEditorの設定を使う
        light = GetComponent<PointLight>();
    }

    void Update() {
        // 強度を滑らかに変化させてランプの明滅を作る
        if (light != null) light.Intensity = baseIntensity * (1.0f + 0.25f * MathF.Sin(Time.time * speed));
    }
}

PointLight ​

宣言・詳説種類・操作役割
public Color4 Colorプロパティ(読取・変更)色を指定します。RGBAではAlphaも持ちます。
public float Decayプロパティ(読取・変更)距離に応じた減衰の強さです。
public bool Enabledプロパティ(読取・変更)このComponentの処理を有効にします。GameObject全体のアクティブ状態とは別です。
public static PointLight FromEntity(GameObject gameObject)関数既にComponentを持つGameObjectから操作用の参照を作ります。Componentを追加する操作ではありません。
public float Intensityプロパティ(読取・変更)光や効果の強度倍率です。
public float Radiusプロパティ(読取・変更)形状または効果の半径です。
public float ShadowRadiusプロパティ(読取・変更)光源の半径です。影のぼけ方に影響します。
public float ShadowStrengthプロパティ(読取・変更)影による減光の強さです。0で影の影響がなくなります。
public static int componentTypeIDプロパティ(読取専用)組み込みComponentの接続識別子です。通常のゲームコードではGetComponentで取得します。

継承する共通操作:Component ​

宣言・詳説種類・操作役割
public T AddComponent<T>() where T : Component関数ComponentまたはScriptを追加し、操作する参照を返します。
public T? GetComponent<T>() where T : class関数component access(owner GameObjectへの委譲)
public T? GetComponentInChildren<T>(bool includeInactive = false) where T : class関数子階層から指定型のComponentを探します。
public T? GetComponentInParent<T>(bool includeInactive = false) where T : class関数親階層から指定型のComponentを探します。
public T[] GetComponents<T>() where T : class関数同じGameObjectにある指定型のComponentをすべて取得します。
public void GetComponents<T>(List<T> results) where T : class関数同じGameObjectにある指定型のComponentをすべて取得します。
public T[] GetComponentsInChildren<T>(bool includeInactive = false) where T : class関数子階層にある指定型のComponentを収集します。
public void GetComponentsInChildren<T>(bool includeInactive, List<T> results) where T : class関数子階層にある指定型のComponentを収集します。
public void GetComponentsInChildren<T>(List<T> results) where T : class関数子階層にある指定型のComponentを収集します。
public T[] GetComponentsInParent<T>(bool includeInactive = false) where T : class関数親階層にある指定型のComponentを収集します。
public void GetComponentsInParent<T>(bool includeInactive, List<T> results) where T : class関数親階層にある指定型のComponentを収集します。
public override int GetHashCode()関数同じ値を検索Keyに使うためのHashを返します。
public bool HasComponent<T>() where T : class関数指定型のComponentを持つかを調べます。
public void RemoveComponent<T>() where T : Component関数指定型のComponentを取り除きます。
public bool TryGetComponent<T>(out T component) where T : class関数Componentを検索し、見つかったかをbool、結果をout引数で返します。
public GameObject gameObjectプロパティ(読取専用)このComponentを所有するGameObjectです。
public Transform transformプロパティ(読取専用)所有GameObjectのTransformです。

継承する共通操作:Object ​

宣言・詳説種類・操作役割
public static void Destroy(Object? target)関数参照先の個体だけを安全地点で破棄する
public override bool Equals(object? obj)関数2つの値が等しいかを調べます。
public override int GetHashCode()関数同じ値を検索Keyに使うためのHashを返します。
public static GameObject Instantiate(Prefab original)関数Prefabまたは指定したGameObject・Componentを複製して参照を返します。生成できない場合は例外です。nullを返す前提で処理しないでください。
public static GameObject Instantiate(Prefab original, GameObject? parent)関数Prefabまたは指定したGameObject・Componentを複製して参照を返します。生成できない場合は例外です。nullを返す前提で処理しないでください。
public static GameObject Instantiate(Prefab original, Vector3 position, Quaternion rotation)関数Prefabまたは指定したGameObject・Componentを複製して参照を返します。生成できない場合は例外です。nullを返す前提で処理しないでください。
public static GameObject Instantiate(Prefab original, Vector3 position, Quaternion rotation, GameObject? parent)関数Prefabまたは指定したGameObject・Componentを複製して参照を返します。生成できない場合は例外です。nullを返す前提で処理しないでください。
public static T Instantiate<T>(T original) where T : Object関数Prefabまたは指定したGameObject・Componentを複製して参照を返します。生成できない場合は例外です。nullを返す前提で処理しないでください。
public static T Instantiate<T>(T original, GameObject? parent) where T : Object関数Prefabまたは指定したGameObject・Componentを複製して参照を返します。生成できない場合は例外です。nullを返す前提で処理しないでください。
public static T Instantiate<T>(T original, Vector3 position, Quaternion rotation) where T : Object関数Prefabまたは指定したGameObject・Componentを複製して参照を返します。生成できない場合は例外です。nullを返す前提で処理しないでください。
public static T Instantiate<T>(T original, Vector3 position, Quaternion rotation, GameObject? parent) where T : Object関数Prefabまたは指定したGameObject・Componentを複製して参照を返します。生成できない場合は例外です。nullを返す前提で処理しないでください。
public static bool operator ==(Object? lhs, Object? rhs)関数等値比較を行います。引数型と戻り値型で、成分ごとの演算か対象参照の比較かを確認してください。
public static implicit operator bool(Object? value)関数暗黙の型変換を行います。引数型と戻り値型で、成分ごとの演算か対象参照の比較かを確認してください。
public static bool operator !=(Object? lhs, Object? rhs)関数不等値比較を行います。引数型と戻り値型で、成分ごとの演算か対象参照の比較かを確認してください。

使用時の注意 ​

届く範囲を必要以上に大きくすると描画負荷が増えます。

Play中の変更は実行用Worldへ反映します。Scene編集のUndoと実行中の値の変更は別です。保存方法は編集と実行時変更を参照してください。

関連項目 ​

現行版マニュアル · 8ea58ba2 · 2026-10-28確認