Hi everyone!
I'm a kind of newbie in Unity and C#. I'm making a little project. In the game at the end of each level it appears a minigame with a scene change. The minigame consists in guessing a word between 3 options. If you fail, the scene of minigame reload, but if you win it comes the next scene. So I want the music of the minigame to no reload if you fail, so I have used this:
private void Awake()
{
GameObject[] musicObj = GameObject.FindGameObjectsWithTag("Neologism1");
if (musicObj.Length > 1)
{
Destroy(this.gameObject);
}
DontDestroyOnLoad(this.gameObject);
}
}
Ant it works perfectly. The problem is that if you win guessing the word, the next scene is loaded, but also the music from the minigame. That is I want the music from the minigame to stop if you guess the word. Sorry if it is something to obvious that I have'nt seen. I've thought about using scriptable objects, but it seems to me too simple to use them. Also trying to combine with scenemanagement, but with no working results.
Thanks a lot in advance and have a nice day!
↧