Question by
drod698 · Jan 29, 2017 at 11:06 PM ·
c#scripting problemaudioprogramming
I need help with code for audio file.
So I have a game object that I added a audio source. I also attached a script to it so that it will continue were it left off if I change scenes. Here it is:
public class Music : MonoBehaviour {
// Use this for initialization
void Start () {
DontDestroyOnLoad (gameObject);
}
// Update is called once per frame
void Update () {
}
}
It works fine up until I return to the scene that has the music object which it will then play the same audio file on top of the already playing one. Please help...?
Comment
Your answer
Follow this Question
Related Questions
Ambient Emitter inside a BoxCollider - Rotation not recognized 0 Answers
Renderer.materials not working in void update() 2 Answers
Trouble changing sound when going through a collider. 1 Answer
Soundarray for player is not working properly 1 Answer
What is the correct way to learn unity scripting ? 2 Answers