Синтаксис:
Используется csharp
public AudioClip play;
bool plays = false;
void PlaySP ()
{
if (plays)
{
audio.clip = play;
audio.Play();
//так же пробовал play.audio.Play();
Debug.Log("Play sound");
plays = false;
}
}
void OnGUI () {
if(GUI.Button(Play,"Начать игру"))
{
plays = true;
Application.LoadLevel("StartGame");
}
}
bool plays = false;
void PlaySP ()
{
if (plays)
{
audio.clip = play;
audio.Play();
//так же пробовал play.audio.Play();
Debug.Log("Play sound");
plays = false;
}
}
void OnGUI () {
if(GUI.Button(Play,"Начать игру"))
{
plays = true;
Application.LoadLevel("StartGame");
}
}
Console:
MissingComponentException: There is no 'AudioSource' attached to the "MainMenu(1)" game object, but a script is trying to access it.
You probably need to add a AudioSource to the game object "MainMenu(1)". Or your script needs to check if the component is attached before using it.
можете что либо подсказать?