two guitexture that do not work together
- by London2423
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<Left> ().enabled = true;
left.transform.position += Vector3.left * Time.deltaTime;
This is the right GUITexture
//move the cube right
Cube.GetComponent<Left> ().enabled = true;
right.transform.position += Vector3.right * Time.deltaTime;
What is the reason for this?
I hope someone can help me.