Hi,
I am having trouble with my Background music. I assigned it to loop and not to delete on load but when you get back to the Main Menu it starts up again. I tried fixing it but I kept getting errors this is the code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class NotDeleteMusic : MonoBehaviour {
// Use this for initialization
void Start () {
// Identify your scene where you have to stop current running music and probably start new one
if (SceneManager.sceneLoaded += "MainMenu")
{
// Find the game object who is playing the audio and STOP audio clip.
GameObject.FindGameObjectWithTag("GameMusic").GetComponent<AudioSource>().Stop();
}
DontDestroyOnLoad(this);
}
// Update is called once per frame
void Update () {
}
}