📜  unity 音频源 playoneshot - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:16.954000             🧑  作者: Mango

代码示例1
public AudioClip impact;
    AudioSource audioSource;

    void Start()
    {
        audioSource = GetComponent();
    }

    void OnCollisionEnter()
    {
        audioSource.PlayOneShot(impact, 0.7F);
    }