Advertisement
Guest User

1

a guest
Apr 24th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class OnCollisionSound : MonoBehaviour
  5. {
  6. private AudioSource audioSource;
  7.  
  8. void OnCollisionEnter2D(Collision2D collision)
  9. {
  10. if(collision.gameObject.tag == "floor")
  11. {
  12. audioSource = GetComponent<AudioSource>();
  13.  
  14. audioSource.Play();
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement