I have created an game for Windows 8.1, the gameplay is similar to an ant smasher, but with spaceships. You click on the spaceship for destroy it, but sometime the click don’t work, if you click on the spaceship is not destroyed.
this is the part of the script who detect the click on the object:
i guess you first need to instantiate the prefabs and then you can destroy it with this script.
public class DestroyPlayAudio : MonoBehaviour
{
public AudioSource audioSource;
public AudioClip clip;
public float volume=0.5f;
void Update()
{
if (Input.GetButtonDown ("0"))
{
Raycast ray=Camera.main.ScreenPointToRay(Input.mousePosition);
Raycasthit hit;
if (Physics.Raycast(ray, out hit))
{
Destroy(hit.collider.gameObject);
audioSource.PlayOneShot(clip, volume);
}
}
}
}
Insert your audiofile in the variable slot in the Monobehaviour.
If you want to create games fast without coding learn and use Playmaker or Game Creator.