Hotbar
Last updated
Last updated
The hotbar is a typical hotbar that you might find in various RPG games in order to quickly use the different items. Weapons would get quickly equipped, items quickly used etc.
In order to setup the hotbar it's very simple. Make sure you have the pre-requisites set up first.
Make sure you have the HotbarBackground gameobject as a child of the InventoryReworkUI Prefab and inside of there on the BackgroundPanel, there is the Hotbar Manager script which should have the Player set to the "Player" Transform Var:
Ensure that the BackgroundPanel has HotbarSlotPrefabs as children of it and each one has a Hotbar Slot component which is setup as per:
Once that's all checked, you'll need to set your items up to be able to use the hotbar as per:
By default, there are two actions for the hotbar:
Weapons/Armour get equipped/unequipped
General Items get used. e.g. 1 taken away each time you use it like eating an apple.
Once that is done, you can test this - go into play mode, and drag an item like an Apple from its slot to the hotbar slot down at the bottom of the screen. It should set it. Now come out of play mode as we now need to connect the inputs.
Once the above is complete, you can setup the inputs as follows:
You need to create an input for each slot. The format is: HotbarManager.UseHotbarSlot(int index)
The int is the number of the slot that is being used.
Note - the number will start at 0 as it's an index of a list. E.g. Slot 1 = 0. Slot 2 = 1, Slot 3 = 2. Slot 4 = 3 etc.
And that's it!