Guest User

Untitled

a guest
Jul 18th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Change something (Collider or the Tag) in the Collision code the sound works but if left as they are Sound doesn't work but the Duck is destroyed
  2.  
  3.  
  4. ---------------------------------Collision Code--------------------------------------
  5. function OnTriggerEnter( hit : Collider ) {
  6.     if(hit.gameObject.tag == "Bullet")
  7.     {
  8.      Destroy(gameObject);
  9.     }
  10. }
  11.  
  12. ---------------------------------Death Code (sound)--------------------------------------
  13. var mySound : AudioClip;
  14. function OnTriggerEnter(hit : Collider)
  15. {
  16.     if(hit.gameObject.tag == "Bullet")
  17.     {
  18.     audio.PlayOneShot(mySound);
  19.     }
  20. }
Add Comment
Please, Sign In to add comment