我將AudioSources作爲播放器對象的子節點,並獲取了我正在使用的腳本。統一 - 爲什麼我不能通過劇本播放我需要的聲音?
所以我實現Audiosources在主類:
public AudioSource good_morning;
public AudioSource stroke_message;
public AudioSource citysound;
public AudioSource silence;
,然後在空白的start()我試圖讓組件和發揮他們的1。但沒有任何事情發生..你能幫助我嗎?
citysound = GetComponentInChildren<AudioSource>();
good_morning = GetComponentInChildren<AudioSource>();
stroke_message = GetComponentInChildren<AudioSource>();
silence = GetComponentInChildren<AudioSource>();
good_morning.Play();
特別是由於音源被聲明爲公共變量。 –
謝謝!我不需要使用GetComponentInChildren –
Pavlos