From the course: Unity 2023 Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Writing the code

Writing the code

- [Instructor] So let's go ahead and implement a script that will play our sound source only when we approach it. And then we'll implement this script for a little teacup that we have in the corner right here, or the kettle. So as we move closer to this kettle, the sound will play as opposed to play from the get-go. So let's go ahead and create the script in our assets here. But again, let's make sure we organize our folders. So we're going to create a folder that will be called Script, and we'll place our script inside of this folder. So always make sure that you're organized when you create new things. And inside of this folder, I'm going to right click, Create and C# Script. And we're going to call this one AudioScript and let's make sure we do the right name here. A quick note, while I'm thinking about it, when you create a script and you call your class a specific name, you want to make sure that your file has the…

Contents