From the course: Cert Prep: Unity Certified Associate Game Developer Scripting with C#

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Timed behaviors

Timed behaviors

- [Illustrator] In the previous chapter of this course we looked at the fundamentals of C-sharp. And in this chapter we'll be looking at how to achieve specific behaviors. And we'll start in this video by looking at how to create timed behaviors. Here we have the car scene that you can find included inside the course exercise files. It's a basic racetrack here with a car on the race track. When I play on the toolbar I can control the car using the W A S and D keys on the keyboard, W moving us forwards here. Now, in this case, when I press play, the car can jump into motion, but I want to display a countdown initially to say three, two, one, go. And when the go message is printed, that's when the car can move forwards but not earlier than that. Let's see how we can set that up using C-sharp. To start, we'll need to actually display the message on the screen. We'll be adding that to the user interface and that's really…

Contents