Search Unity

Animation and script don't communaicate

Discussion in 'Editor & General Support' started by unity_17maca, Jan 21, 2019.

  1. unity_17maca

    unity_17maca

    Joined:
    Mar 27, 2018
    Posts:
    6
    I'm having a problem that my Debug.Log does not tell me the right color.

    I have a code that checks the material color on my cube.

    Code (CSharp):
    1.  
    2.             Renderer rand = hit.transform.GetComponent<Renderer>();
    3.             Debug.Log("material = " + rand.material.color);
    4.  
    I have made an animation that animates the cube color from white to red, but my Debug.Log-color-message does not change.

    Here is a video of it:


    Can someone help me so my Debug.Log tell me the right color?
     
    Last edited: Jan 21, 2019