Quantcast
Channel: Questions in topic: "dontdestroyonload"
Viewing all articles
Browse latest Browse all 416

How to make audio play at once.

$
0
0
My background music starts playing when you get into the main menu. But if I go to another scene and come back to the main menu the background music starts playing one more time. So they are playing on top of each other its like I hear the music from two different sources and they are not synced. My script: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Animations; public class MusicClass : MonoBehaviour { AudioSource bgSource; void Start() { bgSource = GetComponent(); bgSource.Stop(); bgSource.Play(); } void Awake() { DontDestroyOnLoad(gameObject); } }

Viewing all articles
Browse latest Browse all 416

Trending Articles