Quantcast
Channel: Questions in topic: "issue"
Viewing all articles
Browse latest Browse all 827

Audio issue

$
0
0
Hi everyone. I cant figure out how to make an AudioClip play when collecting coins. I made coins to get Destroyed when pickeup and my AudioClip gets destroyed as well before it even gets a chance to play. Can someone help please. var coinValue = 1; var coinCollect : AudioClip; function Update() { } function OnTriggerEnter (col : Collider) { GameMaster.curGold += coinValue; audio.Stop(); audio.PlayOneShot(coinCollect); print(GameMaster.curGold); // Put some code in here Destroy(this.gameObject); } If I change this.gameObject to col.gameObject then my pleyer gets destroyed and then I get audio to play. How do I go around Destroy gameObject for to audio to play?

Viewing all articles
Browse latest Browse all 827

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>