Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development How to Make a Video Game Game Audio Play Sounds with Scripts

Joel Brown
Joel Brown
4,590 Points

Compile errors

So i'm having some compile errors. It's not letting me add the Random Sound script to the bird calls object as a component until i fix them. Please help! Errors are:

Assets/Scripts/RandomSoundPlayer.cs(32,38): error CS1502: The best overloaded method match for `System.Collections.Generic.List<UnityEngine.AudioClip>.this[int]' has some invalid arguments

Assets/Scripts/RandomSoundPlayer.cs(32,46): error CS1503: Argument #1' cannot convertmethod group' expression to type `int'

Could you show us your code as well, please?

Joel Brown
Joel Brown
4,590 Points

I figured it out. Thank you though =).