the sound is repeated

the sound is repeated at specified “loop = false;”. Why? and how can I play a sound in only 1 second?
Code

using UnityEngine;
using System.Collections;

public class sound : MonoBehaviour {
    public AudioClip impact;
    AudioSource audio;

    // Use this for initialization
    void Start () {
        audio = GetComponent<AudioSource> ();
    }

    void OnCollisionEnter2D(Collision2D col){
        audio.loop = false;
        audio.PlayOneShot (impact, 1f);
    }

    // Update is called once per frame
    void Update () {

    }


}

I tried reproducing the error you describe, but for me, I’m not really seeing the sound repeated:

https://www.youtube.com/watch?v=d05mhzOHDDI

What version of Unity do you have? I’m on 5.3.4f1 Personal.

Thanks.

I am using the same version

Sorry, it’s my fail. I did not write the name of the object hit, in contact with which the sound should be played. How can I play a sound in only 1 second? I can not use “yield return” because in one second can be 3 a collision and stop the sound at all :frowning: Sorry for my English:) I hope you understand me.

If you want to play a sound for 1 second, why not use a 1 second WAV file?

You might be able to take an existing sound and “crop” it to 1 second using something like Audacity.

How many seconds is the sound right now?

Thanks.

I “crop” the sound in the program. Thanks.