Показать сообщение отдельно
Старый 22.12.2013, 16:16   #20
Okay
Знающий
 
Регистрация: 21.11.2011
Сообщений: 284
Написано 17 полезных сообщений
(для 74 пользователей)
Ответ: Вопросы от Okay

Что за ошибка такая?
MissingComponentException: There is no 'AudioSource' attached to the "menu_s" game object, but a script is trying to access it.
You probably need to add a AudioSource to the game object "menu_s". Or your script needs to check if the component is attached before using it.
menu_s.Start () (at Assets/scripts/menu_s.cs:11)
Вот код
[RequireComponent(typeof(AudioSource))]
public class menu_s : MonoBehaviour 
{

	public GameObject spritelogo;
	public AudioClip menusound;
	// Use this for initialization
	IEnumerator Start () 
	{
		audio.Play();
		yield return new WaitForSeconds(audio.clip.length);
		audio.clip = menusound;
		audio.Play();

	}
	
	// Update is called once per frame
	void Update () 
	{
	}
}
(Offline)
 
Ответить с цитированием