on MouseDown = ..... android

hi

i have an object and i want it to be a trigger for animation , and i have created it with " On MouseDown " , but for android i don’t know how

i got the TouchCount but i cant make it for the object

You could do a raycast. Have not tried my script, but here’s what you could do, I think. This will raycast from screen where the touch took place, and if any object is being hit, then it turns the material color to red. You should do a if statement to test if the right object is hit, and you probably want to raycast certain layers.

using UnityEngine;
using System.Collections;

public class test : MonoBehaviour {
    void Update() {
        int i = 0;
        while (i < Input.touchCount) {
            if (Input.GetTouch(i).phase == TouchPhase.Began) {
                Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(i).position);
                RaycastHit hit;
                if (Physics.Raycast(ray, out hit, 100.0F))
                    hit.transform.gameObject.renderer.material.color = Color.red;
                
            }
            ++i;
        }
    }
}