Net.Like.Xue.Tokyo/Assets/Artists/Scripts/LuminaSetupController.cs

32 lines
822 B
C#
Raw Normal View History

2025-02-26 20:56:15 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using Artngame.LUMINA;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Net.Like.Xue.Tokyo
{
public class LuminaSetupController : MonoBehaviour
{
[SerializeField]
private LUMINA lumina;
private void FixedUpdate()
{
if (!lumina.sun)
{
foreach (var rootGameObject in SceneManager.GetActiveScene().GetRootGameObjects())
{
if(rootGameObject.TryGetComponent<Light>(out var rootLight) is false)continue;
if(rootLight.type is not LightType.Directional)continue;
lumina.sun = rootLight;
return;
}
}
}
}
}