Interested in this Tutorial?

Check out the about tab below and start learning on CG Cookie today.

Start a Free Trial

Creating a UI Speedometer

crew

Create a Digital Speedometer

This Unity tutorial will go over how to create and script a UI speedometer for our motorcycle. The motorcycle may look familiar as it was taken from the fantastic Blender course by Chris Kuhn found here: Modeling a Motorcycle. I wanted to bring this into Unity to add a digital speedometer modeled off some real world digital speedometers found in cars currently out there.

We'll use the UI system in Unity 4.6 to mimic a bar being filled to represent the speed increasing along with text elements to update our actual speed value in real time. C# will be used to control the increase and decrease in speed. It's fairly simple and straightforward but looks really cool and can be applied to a lot of different game mechanics.

By the end of this video you should know how to create this:

 

SpeedometerUnity

The source files include the motorcycle model along with the UI images you'll need and the completed C# script. The only thing you'll need to import yourself is the font file (if you want to follow along, it's not required). The font file is called Digital-7 and can be found here: http://www.dafont.com/digital-7.font