Reputation: 5
I have this code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Audio;
using UnityEngine.EventSystems;
public class start : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
public GameObject musica;
public bool pulsado;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void OnPointerDown(PointerEventData eventData)
{
pulsado = true;
audio();
SceneManager.LoadScene("pajaro");
}
public void OnPointerUp(PointerEventData eventData)
{
pulsado = false;
}
void audio()
{
musica.SetActive(true);
}
}
When I export it to Android, touch does not work, but if it works in unity
Upvotes: 0
Views: 77
Reputation: 15951
You're using OnPointerDown
, this is specific to the mouse, this event does not fire for Touch input (touch input does not have a concept of "up" and "down").
In order to have touch input, you have to use Input.touches
during the Update()
loop.
Upvotes: 1