Hi,
I have 5 cube that all 5 cube have audiosource. When my player jump into those cubes, the audiosource is playing(just once). It was working. But then, I decided to organised my hierarchy and audiosource didn’t work well.
When I jump to first cube, the audio is playing but then ıf I try to jump to the other cubes, audio is not working. (Actually the cube is prefab 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 ? Because 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 ) :
[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
}
}
}
Thanks advance