From the course: Unity 3D 2019 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Implementing the script

Implementing the script - Unity Tutorial

From the course: Unity 3D 2019 Essential Training

Start my 1-month free trial

Implementing the script

- [Instructor] So, now that we've created a script, let's implement it with our coffee machine. So, the first thing I'm going to do is double-click on the coffee machine, and then the first thing I'm going to do is to make sure that it doesn't play on awake. Because if I leave that checked, when you start the game or if you create a video, the sound will play right away. What we want is to have a trigger, so a collider that will act as the trigger, and actually start the sound when we get close to the machine. So, let's uncheck that, and then what we're going to do is add the script to the coffee machine. So, you can simply drag and drop the script directly to the coffee machine, like so, and it will be applied to the coffee machine. And now, when we wrote our script, we had a source. So, the source is going to be the express machine. So, our espresso maker. So, let's select that, when you click on it. And then the…

Contents