Add a horizontal scrollbar to the inventory slot display

How could we cope with many inventory slots, more than fit in the space provided? One solution is to add a scroll bar so that the user can scroll left and right, viewing five at a time, say, as shown in the following screenshot.

Let's add a horizontal scroll bar to our game. This can be achieved without any C# code changes, all through the Unity 5 UI system.

To implement a horizontal scrollbar for our inventory display, we need to do the following:

  1. Increase the height of Panel-background to 110 pixels.
  2. In the Inspector panel, set the Child Alignment property of component Grid Layout ...

Get Unity 2018 Cookbook - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.