Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity audio source playoneshot

public AudioClip impact;
    AudioSource audioSource;

    void Start()
    {
        audioSource = GetComponent<AudioSource>();
    }

    void OnCollisionEnter()
    {
        audioSource.PlayOneShot(impact, 0.7F);
    }
 
PREVIOUS NEXT
Tagged: #unity #audio #source #playoneshot
ADD COMMENT
Topic
Name
1+5 =