So I have looked around the Internets and I haven’t been able to find a decent explaination for my question. Basically I want a short clip to play after my character “picks up” a coin (more like destroys it). I’ve tried several times using different techniques so I just wanted to ask myself to see if anyone can tell me how to make this work. Here’s the code, and if you need any clarification I’d be happy to help.
using UnityEngine;
using System.Collections;
public class PowerUpScript : MonoBehaviour {
HUDScript hud;
void OnTriggerEnter2D(Collider2D other)
{
if(other.tag == "Player")
{
hud = GameObject.Find ("Main Camera").GetComponent<HUDScript>();
hud.IncreaseScore(10);
Destroy (this.gameObject);
}
}
}