Hello everyone …
I have one object which is rotating on z axis. Based on the rotation of that object i want to change the texture of another object.
For that i have written one script :
function Update () {
if(rotateArrow.transform.eulerAngles.z > 90 && rotateArrow.transform.eulerAngles.z < 270)
{
transform.renderer.material.SetTexture("_MainTex", p_stand_text_left);
gameObject.tag = "player_left";
}
if(rotateArrow.transform.eulerAngles.z < 90 && rotateArrow.transform.eulerAngles.z > 270)
{
Debug.Log("do" + rotateArrow.transform.eulerAngles.z);
transform.renderer.material.SetTexture("_MainTex", p_stand_text_right);
gameObject.tag = "player_right";
}
}
But not working as i am changing the rotation of the object.
So what is mistake in my script?
Can anyone guide me. I have also tried by using transform.rotation.z then also its not working.
Thanks you all for your support and help till now.