Created
November 21, 2019 19:28
-
-
Save edsilv/ea3d8167b1426d3bdb537e0410b42c33 to your computer and use it in GitHub Desktop.
Ambient Light Fader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| public class Lighting : MonoBehaviour | |
| { | |
| float duration = 10.0F; | |
| float min = 0.0F; | |
| float max = 1.0F; | |
| static float t = 0.0f; | |
| void Start() | |
| { | |
| } | |
| void Update() | |
| { | |
| float intensity = Mathf.Lerp(max, min, t); | |
| t += 0.5f * Time.deltaTime; | |
| RenderSettings.ambientIntensity = intensity; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment