Первый коммит с LFS.
This commit is contained in:
1 parent
4fcb1e2f24
commit
179816dc4b
5084 files changed
+3714098
-1
No files matched your search
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal; // Assuming URP. Change if using built-in or HDRP.
|
||||
|
||||
public class BrightnessController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Volume postProcessVolume;
|
||||
private ColorAdjustments colorAdjustments;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (postProcessVolume != null && postProcessVolume.profile.TryGet(out colorAdjustments))
|
||||
{
|
||||
// Successfully found the ColorAdjustments effect
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("BrightnessController could not find a Volume with ColorAdjustments.", this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the brightness.
|
||||
/// </summary>
|
||||
/// <param name="value">A value from 0 (dark) to 1 (bright).</param>
|
||||
public void SetBrightness(float value)
|
||||
{
|
||||
if (colorAdjustments != null)
|
||||
{
|
||||
// We map the 0-1 slider value to a new exposure range, e.g., -1 to 1.4.
|
||||
colorAdjustments.postExposure.value = Mathf.Lerp(-1f, 1.4f, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user