1

“当前上下文 [Assembly-CSharp] 中不存在名称‘来源’”,

帮助!(统一2017.3.0f3)

这是代码:

public static SoundManager Instance = null;

public AudioClip goalBloop;
public AudioClip lossBuzz;
public AudioClip hitPaddleBloop;
public AudioClip winSound;
public AudioClip wallBloop;

private AudioSource soundEffectAudio;

// Use this for initialization
void Start () {

    if(Instance == null)
    {
        Instance = this;
    } else if (Instance != this)
    {
        Destroy(gameObject);
    }

    AudioSource[] source = GetComponents<AudioSource>();

    foreach(AudioSource source in sources)
    {

    }

}
4

1 回答 1

0

您在 foreach 语句中输入了源,而不是源(在此处声明:)AudioSource[] source = GetComponents<AudioSource>();。您已声明源,但正在使用导致错误的源。

于 2018-05-11T20:08:56.803 回答