Hi, I have primitive question, I before 2 minutes looked on Unity Learn.
He changing color with Input Z and Input C.
I now maked 3D Text and added box collider. Then created script ‘ChangeColor’.
There I writed two public class, first is Enum, seconds is ChangeColor.
In the first class I wroted OnMouseOver, OnKey.
In the seconds class I wroted:
public type choosenTyp;
public Color ColorOnHover;
public Color ColorNormal;
public KeyCode key;
public float smooth;
public Color now;
void Awake() {
now = ColorNormal;
}
// Update is called once per frame
void Update () {
gameObject.renderer.material.color = Color.Lerp(gameObject.renderer.material.color, now, Time.deltaTime * smooth);
}
void OnMouseEnter() {
if (choosenTyp == type.OnMouseOver) {
now = ColorOnHover;
}
}
void OnMouseExit() {
if (choosenTyp == type.OnMouseOver) {
now = ColorNormal;
}
}
But when I move on Text, text change color to transparent. I don’t see text. Why it doing this ?