需要帮助使用C#统一更改屏幕的亮度

问题描述 投票:0回答:1

我需要一些帮助。我正在团结一致,并试图随着时间的推移更改屏幕的亮度,但似乎没有任何效果。我正在尝试获取游戏的灯光部分并调整其强度。

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; 
    }
}
c# unity3d light
1个回答
0
投票

您可以使用的一种解决方法是覆盖整个屏幕的UI层上的黑色滤镜(最好是Image)。您可以相应地更改滤镜的不透明度,以达到屏幕变暗的感觉。

© www.soinside.com 2019 - 2024. All rights reserved.