Hello!
I'm working on a project demo which need to run both on PC and on mobile devices and I'm having some difficulties when it comes to inventory drag on mobile. Actually, I had 2 issues with inventory drag, but let's go in order.
First thing, I'm using POint and Click interaction method. It works perfectly on PC and it is fairly usable on mobile device as well. The thing is, I don't want the cursor to show up on phones and tablets. Easy enough, In the Game Load Action List I added a check for a touch device and disabled the cursor with the Engine Manage System action. It's all fine and dandy until I realize that now I'm unable to see whichever item I'm dragging out of my inventory, because the cursor is still invisible. I've looked in the EventManager and PlayerMenus but I cannot find any sign of an event that fires when i start (and end) dragging an inventory item. I've created a custom action to replace it, but changes persist after running the game in editor and that makes me doubt it's the right way to handle this.
Aside from the solution for the cursor texture change, I also needed on drag start (and end) events for closing the inventory UI whenever I try to drag items outside of it. I've seen the hacky solution suggested here on this forum, but it feels clunky. Would it be possible to have both those events available in the EventManager?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @Acciaio.
If you're specifically referring to the "Main cursor", you can disable it at the top of the Cursor Manager - or assign an invisible texture. This should allow for the inventory cursor to display as normal.
You can hook into the OnInventorySelect / OnInventoryDeselect events if necessary - since an item's drag state is synced with it being selected:
Are you referring to the moment an item is selected, or is it based on the drag position?
I'm not sure what method you've tried already, but you can check if the AC cursor is currently over a given Menu with:
Thanks for the answer, Chris!
Yes, in the end I've ended up setting the main texture to null and it seems to be working pretty fine.
That was my first attempt, but it messed everything up whenever I examined or used an object, since if I decided to use or examine one object after another every time the first item was deselected the inventory closed. In the end, I went with using a second invisible menu overlaying the first one that only cares for cursor hover that closes the inventory when the cursor exits it.
I was referring to the cursor position. I haven't thought about the possibility to check if the cursor was inside a given menu. I'll give it a try! Thanks for the help!