- Home /
Touch not working on guiTexture.
I am trying to move the images in the scene through a touch button, i tried something but it doesnt seem to work, and also the the texture doesnt show up on screen.
public Texture2D Button;
// Use this for initialization
void Start () {
guiTexture.texture = Button;
}
// Update is called once per frame
void Update () {
foreach(Touch touch in Input.touches)
{
if(guiTexture.HitTest(touch.position) && touch.phase == TouchPhase.Began)
{
Debug.Log("Touching");
GameManager.a++;
}
else if(guiTexture.HitTest(touch.position) && touch.phase == TouchPhase.Ended)
{
Debug.Log("Not-Touching");
}
}
}
Comment
Your answer
Follow this Question
Related Questions
How to make GUI pop up when you touch other gui 1 Answer
Unity3d Get Cube Pressed On Mobile 1 Answer
Button as a child of a button 0 Answers
Distribute terrain in zones 3 Answers
IOS GUI slider 1 Answer