Check out example codes for "music that stays when you change scene unity". It will help you in understanding the concepts better.

Code Example 1

using UnityEngine;
public class MusicClass : MonoBehaviour {
  private AudioSource _audioSource;
  private void Awake()
  {
    DontDestroyOnLoad(transform.gameObject);
    _audioSource = GetComponent<AudioSource>();
  }
  public void PlayMusic()
  {
    if (_audioSource.isPlaying) return;
    _audioSource.Play();
  }
  public void StopMusic()
  {
    _audioSource.Stop();
  }
}

Learn ReactJs, React Native from akashmittal.com