Skip to content

Instantly share code, notes, and snippets.

@edsilv
Created November 21, 2019 19:28
Show Gist options
  • Select an option

  • Save edsilv/ea3d8167b1426d3bdb537e0410b42c33 to your computer and use it in GitHub Desktop.

Select an option

Save edsilv/ea3d8167b1426d3bdb537e0410b42c33 to your computer and use it in GitHub Desktop.
Ambient Light Fader
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