Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public var soundClip : AudioClip[];
- private var looper : int = 0;
- function OnTriggerStay (col:Collider){
- if(Input.GetKey("e")) {
- if(!audio.isPlaying)
- {
- audio.clip = soundClip[looper];
- audio.Play();
- looper++;
- looper = looper%soundClip.Length;
- gameObject.DestroyObject(GameObject);
- }
- }
- }
- When u press the E key it plays sound and then Destroy The Object.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement