sinaj_1
February 19, 2017, 9:27pm
1
Hello, i have this problem
im using
void Awake()
{
DontDestroyOnLoad(transform.gameObject);
}
}
Im using it to dont destroy music on load for scene 1 and 2.
My question is - how can i destroy this music from scene 1 and 2 when i start scene 3 thank you…
And sorry for my english…
Why don’t you use it in the start method?
Also, you’re sending the transform of the gameobject as parameters to not be destroyed, I think you should be sending the object itself.
sinaj_1
February 20, 2017, 9:02am
3
i tryd this script, but i still plays the same music on level3
{
static bool AudioBegin = false;
void Start()
{
if (!AudioBegin)
{
GetComponent<AudioSource>();
DontDestroyOnLoad(gameObject);
AudioBegin = true;
}
}
void Update()
{
if (Application.loadedLevelName == "leve3")
{
GetComponent<AudioSource>();
AudioBegin = false;
}
}
}
sinaj_1:
ok fixt it.
thank you
how to fix, you can help me, thank you, you use code
???