Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to make this script work on android?

Discussion in 'Scripting' started by JeremyGames, Aug 3, 2016.

  1. JeremyGames

    JeremyGames

    Joined:
    Jul 4, 2014
    Posts:
    21
    Hello,
    Can someone help make my script that deletes a sprite with the script attached to it on click work with android?
    I'm new to android develop and don't know how to convert mouse down to the native android version.

    using UnityEngine;
    using System.Collections;

    public class Destroy : MonoBehaviour
    {

    void OnMouseDown() {
    Destroy(gameObject);
    }
    }

    Thanks!
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    all the "OnMouse###" functions should automatically work for touches (just the first touch, doesn't support multitouch in this form)
     
  3. JeremyGames

    JeremyGames

    Joined:
    Jul 4, 2014
    Posts:
    21
    Is it possible to change that?