Book Image

Building an FPS Game with Unity

By : John P. Doran, jamal seaton
5 (1)
Book Image

Building an FPS Game with Unity

5 (1)
By: John P. Doran, jamal seaton

Overview of this book

Table of Contents (18 chapters)
Building an FPS Game with Unity
About the Author
About the Reviewers

Replacing the default UFPS HUD

We now have a Main menu, but our regular game level is showing a default UI. While it's fine for testing purposes, we may want to make something a little more custom for our finished product.

  1. Start off by opening up any of the levels you've created that have the AdvancedPlayer prefab inside it (I chose Chapter7_MeshingYourLevel).

  2. From there select your AdvancedPlayer and look at it from the Inspector. One of the components you'll see is the vp_SimpleHUD component.

    This is what draws the screen in the default way and can be a good reference when it comes to accessing variables. However, we do not want to use it in this case.

  3. Right-click on the vp_SimpleHUD component and select Remove Component.

  4. Now that we've removed the previous HUD, it's time to add in our own. Create a Canvas by selecting GameObject | UI | Canvas.

  5. For our purposes we're going to be using Slider as the basis of our lifebar. To do that with the Canvas selected, go to GameObject | UI | Slider.

    A slider...