How Can I Change General Light Settings With Script
I want to change Ambient Source Color>Ambient Color and Ambient Intensity with script i have day and night script i now where the code will add but i don't know how to. Can someone help with this?? Code must be type of CS. Thanks.
Answer by Graphics_Dev · Mar 01, 2016 at 06:44 PM
Here are the references:
http://docs.unity3d.com/ScriptReference/RenderSettings-ambientLight.html
http://docs.unity3d.com/ScriptReference/RenderSettings-ambientIntensity.html
and do you know how can i write color type with numbers for example red = (1.0.0.1)
You can setup a color in the inspector like this...
using UnityEngine;
using System.Collections;
public class AmbientChange : $$anonymous$$onoBehaviour {
public Color my_color;
// Use this for initialization
void Start () {
RenderSettings.ambientLight = my_color;
}
}
Or use a Vector4
using UnityEngine;
using System.Collections;
public class AmbientChange : $$anonymous$$onoBehaviour {
// Use this for initialization
void Start () {
RenderSettings.ambientLight = new Vector4(1,0,0,1);
}
}
Your answer

Follow this Question
Related Questions
Working on dual controls using character controller 0 Answers
NullReferenceException: Error from the GetStyle() - Method 1 Answer
Play animation on mouse click 1 Answer
Rayscast from the GameObject that is not the player does not work 0 Answers
unity C# Errors `UnityEngine.Material' does not contain a definition for `SetColorArray' 0 Answers