I have two GUITexture that move left and right a cube. Is pretty strange but together they don't work. If I activate only one it works. To be more specific: If I have the left GUItexture alone in the game the cube move left. If I have the right GUITexture activated alone the cube move right. Seems all fine I thought but If I have both of them the cube move only right and not left. Where is the mistake?
Here is the code inside the GameObject cube for Right move
void OnMousedown () {
transform.position += Vector3.right * Time.deltaTime;
For Left move
void OnMousedown () {
transform.position += Vector3.left * Time.deltaTime;
And this is the left GUITexture code
//move the cube left
Cube.GetComponent ().enabled = true;
left.transform.position += Vector3.left * Time.deltaTime;
}
This is the right GUITexture
//move the cube right
Cube.GetComponent ().enabled = true;
right.transform.position += Vector3.right * Time.deltaTime;
What is the reason for this?
Why they don't work together meaning when I push the left gui texture the cube moves left and when I push the right guitexture the cube move right
I hope someone can help me. I really have no clue and did search all day about this
CL
↧