Hotbar Questions

Hi there!

A few questions about the ItemHotbar:
  1. I have a fairly simple implementation of the ItemHotbar (not using any of the demo player input stuff), which works great with the keyboard and mouse, but I'm wondering the best way to go about hooking it up to work with a game controller. I was digging through the demo code and wasn't able to figure it out and didn't want to just drop the entire thing in when I really didn't need all of the code.
  2. Instead of using the "equip" ItemAction, I have a separate ItemAction set up for using tools in my game. This is all set up and working nicely, but for the life of me, I can't figure out how to change the sprite for the QuickItemSlotUI when I use my own ItemAction function so that I can highlight it. Any suggestions on where to start?
  3. How can I get the ItemHotbar loadout to save when saving/loading? I have everything else with the inventory saving/loading fine. In case it complicates your answer, I'm also utilizing UISSaver component from PixelCrushers Dialogue System.
Happy to provide any additional details, as I know these questions are a bit vaguer than usual.

Thanks!
 
1) The Item Hotbar has a UseItem(int index) function. You can create a custom script that takes your gamepad input and then call that function

2) Humm that is quite tricky. You would need to get the QuickItemSlot from the Hotabar and use GetComponentInChildren<Image> to get your image or have a custom component that references the image you want to edit.

3) This is something that is missing ... I'll make sure to add a way to save the hotbar in the next update. You could try doing it yourself but since I need to do it I would advise not wasting your time on it unless it is very pressing.

Note V1.1 should come out in November and it makes the current hotbar implementation obsolete. Most of the UI scripts are completely re-written and the asset should be a lot easier to use and quicker to set up. If you are not in the final stages of production I would advise waiting for us to release V1.1 it will be worth it.

If you wait for V1.1 the answers I just gave you change.

1) There is a new Inventory Input component which has input for the items, hotbar, UI, etc... , you'll be able to set the keyboar or gamepad input directly on that component (there are plans to integrate with Rewired and the new input system later)

2) You'll be able to get the Item View (replacing the ItemBox component) from the Item Hotbar. From there you can get the image and do what you want with it.

3) I'll do my best to implement the Item Hotbar Saver for V1.1

I hope that helps
 
Top