Есть у меня скрипт для переноса играемой музыки из одной сцены в другую, но я хочу остановить проигрывание в сцене номер 2.
Код
using UnityEngine;
using System.Collections;
public class music : MonoBehaviour
{
public static bool muze;
public int level;
void Start()
{
if (muze == false)
{
audio.Play();
muze = true;
}
else {
audio.Stop(); }
}
void Awake()
{
DontDestroyOnLoad (transform.gameObject);
}
void Update()
{
if (!audio.isPlaying) {
audio.Play();
}
}
}