Im getting an index out of bounds error that gives a code line to this area, specifically L64. im a little confused as to why becuse the size of the array is serialized and i have a sound file in each slot so this should be working. thanks for the help.
change ballSounds.Length to ballSounds.Length-1
because starting index in array is 0
so random.range is exclusive on the upper bound so that shouldnt be a problem. but i tried it any way and it still is throwing the same error, i then just deleted that and told it to play index one and it still throws and index out of bounds error. though this whole time it is playing sounds and working its just throwing the error too.
Maybe you didn’t save the changes in ball script to your prefab? And then when next scene is loaded you get this error, because prefab didn’t have any sounds.
Select the ball with sounds, and on the Ball script component press 3dots symbol (top right) -> modified component -> apply to prefab
I think this can help.