Skip to Content
Mastering UI Development with Unity
book

Mastering UI Development with Unity

by Dr. Ashley Godbold
April 2018
Beginner content levelBeginner
468 pages
11h 7m
English
Packt Publishing
Content preview from Mastering UI Development with Unity

Using KeyCode with the Inventory Panel

Let's begin with the Inventory Panel. We want the panel to pop up and close when the i key is pressed on the keyboard. To make the Inventory Panel appear and disappear with the i key, complete the following steps:

  1. Create a new C# script in the Assets/Scripts folder by right-clicking within the Project view of the folder and selecting Create | C# Script from the pop-up panel.
  2. Name the script ShowHidePanels, and then double-click on it to open.
  3. We will now go to the public CanvasGroup variable called inventoryPanel to represent the panel. We will use a CanvasGroup variable type to reference the panel, since we want to access the properties of the Canvas Group component. Update your ShowHidePanels script ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Game Development with Unity for .NET Developers

Game Development with Unity for .NET Developers

Jiadong Chen
Unity UI Cookbook

Unity UI Cookbook

Francesco Sapio

Publisher Resources

ISBN: 9781787125520Supplemental Content