The code below should change the color in the variable, don’t you think?
private var c_previous_color : Color = Color.black;
function Start () {
c_previous_color == Color.black;
Debug.Log("c_previous_color=" + c_previous_color + " " + Random.Range(0, 100000));
c_previous_color == Color(0.5, 0.5, 0.5, 0);
Debug.Log("c_previous_color=" + c_previous_color + " " + Random.Range(0, 100000));
c_previous_color == Color.red;
Debug.Log("c_previous_color=" + c_previous_color + " " + Random.Range(0, 100000));
}
(I added the Random.Range so that each Debug.Log statement would be different and would therefore show up in the log.)
The log file shows this:
c_previous_color=RGBA(0.000, 0.000, 0.000, 1.0000) some random number here
UnityEngine.Debug:Log(Object)
c_previous_color=RGBA(0.000, 0.000, 0.000, 1.0000) some random number here
UnityEngine.Debug:Log(Object)
c_previous_color=RGBA(0.000, 0.000, 0.000, 1.0000) some random number here
UnityEngine.Debug:Log(Object)
So the color is not being changed. What am I doing wrong? :?