O'Reilly logo

Building an RPG with Unity 5.x by Vahé Karamian

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

Integrating the code

Now that we have our HUD design up and running, we will need to integrate the UI elements with the actual code that will be deriving them. There are a few scripts that are going to be created to support the new UI features, and a few that will be updated to glue everything together.

The following scripts have been created: ActiveInventoryItemUI.cs, ActiveSpecialItemUI.cs and HUDElementsUI.cs.

The listing of these scripts is as follows:

using UnityEngine; 
using UnityEngine.UI; 
using System.Collections; 
 
public class ActiveInventoryItemUI : MonoBehaviour 
{ 
  public InventoryItem item; 
 
  public Image imgActiveItem; 
  public Text txtActiveItem; 
 
} 
using UnityEngine; using UnityEngine.UI; using System.Collections; using UnityEngine.EventSystems; ...

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