I have 5 cubes and all 5 cubes have an audiosource
. When my player jumps into those cubes, the audiosource
is playing just once. It was working. But then, I decided to re-organize my hierarchy and audiosource
didn’t work well.
When I jump to first cube, the audio plays but then if I try to jump to the other cubes, the audio does not play. I have a prefab cube and all 5 cubes are the created from that prefab. It gives Can not play a disabled audio source
and I don’t know why? I haven’t changed about coding part.
This is my first cube component :
The other 4 cubes (actually they all the same as with the first cube):
Coding Part :
//Eğer karakter ses efekti tamamlanmadan diğer paddle'a atlarsa paddle ses çıkarmıyor. Bunu düzelt
(SerializeField) AudioSource clickSound;
bool landedorNot = false;
void Start()
{
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.name == "Ship New Pos" && landedorNot == false )
{
landedorNot = true;
if (!clickSound.isPlaying)
{
clickSound.Play(); // this is where the error occurs according to Unity
}
}
}