O'Reilly logo

Unity 3 Game Development HOTSHOT by Jate Wittayabundit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a hit-point UI

Now we are at the last step of this chapter. We will add the hit-point game object for the player and enemy as well as create the HitPointUI script.

Engage Thrusters

Before we start creating the HitPointUI script , we will need to create the HitPointUI game object to contain it:

  1. First, go to Unity and create an empty game object by going to GameObject | Create Empty, and name it HitPointUI. Then, we will reset the Transform to default as follows:
    • Position X: 0 Y: 0 Z: 0
    • Rotation X: 0 Y: 0 Z: 0
    • Scale X: 1 Y: 1 Z: 1
  2. Next, create a new script by going to Assets | Create | Javascript, name it HitPointUI, double-click on it to open MonoDevelop, and replace it with the following code:
    public var ai : AIController; public var player : ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required