我需要一些帮助。我正在团结一致,并试图随着时间的推移更改屏幕的亮度,但似乎没有任何效果。我正在尝试获取游戏的灯光部分并调整其强度。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class lightning : MonoBehaviour
{
//This is lightning
Light lit;
// Start is called before the first frame update
void Start()
{
lit = GetComponent<Light>();
}
// Update is called once per frame
void Update()
{
lit.color -= (Color.white / 8.0f) * Time.deltaTime;
}
}
您可以使用的一种解决方法是覆盖整个屏幕的UI层上的黑色滤镜(最好是Image)。您可以相应地更改滤镜的不透明度,以达到屏幕变暗的感觉。