unity 2017 Problem with touch and ui button
Hello when I put the buttons of ui and I put the plugin stalone input touch, this simplemnte does not work, is there something to limit the cordenadas of the touch or the script that I have is very old?
using UnityEngine; using System.Collections;
public class InstatieTouch : MonoBehaviour { Vector3 objPos; public TriggerHot Trigger; public GameObject Cube; public int Intentos= 0;
public GameObject Seguro;
void Start()
{
}
// Update is called once per frame
public void Update()
{
// if (Intentos <=2)
// {
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
{
//if (Input.GetTouch(0) < Screen.height / 2)
//
Vector3 fingerPos = Input.GetTouch(0).position;
fingerPos.z = 5;
objPos = Camera.main.ScreenToWorldPoint(fingerPos);
Seguro.transform.position = objPos = new Vector3(objPos.x, objPos.y, -8f);
// }
Touch touch = Input.GetTouch(0);
if (touch.position.x > (Screen.height))
{
print("mmmm" +Screen.width);
}
//453 heig, 725widht
/// Cube = Instantiate(Cube, objPos, Quaternion.identity) as GameObject;
// GameObject Cube1 = Instantiate(Cube, objPos, Quaternion.identity) as GameObject;
}
//}
}
public void GoSpawn()
{
GameObject Cube1 = Instantiate(Cube, objPos, Quaternion.identity) as GameObject;
Intentos++;
Trigger.ZombieDeath();
Trigger.Dardo();
}
}
Comment