Ok, I see. I misunderstood what you meant by input. You can setup units to receive input in their blueprint settings, but I would not recommend this as you would need to add branches to all units to make sure that they are the active unit which would trigger for all units every time you click the input key, which is both clunky and inefficient. Epic generally advises to put input in the player controller anyway.
But that receiving the input is handled by the player controller does not mean that the rest of the logic cannot be handled in another blueprint. In fact that is exactly what Iām doing with the ability blueprints. If you choose to do inventory like you describe it (using collision and clicking), here is one way to make it work:
Handle the click event in the player controller. If you detect that you have clicked an item we want to know if is on a tile next to the active unit and that the active unit is currently being controlled by the player who owns the player controller receiving the input. For this last part, check the nodes following the click input in the player controller, where I do this already.
For finding out whether the item is adjacent to the unit you can use the GetDistanceInTilesBetweenIndexes (or a similar name. Cannot check now) function in BP_GridManager. The input for this function is two grid indexes, so you would want to convert the location of the item to a grid index by using the ConvertLocationToIndex function also in BP_GridManager. You can also be a lot more lazy and simply take the location of the active unit and the item and check if the distance between them is lower than TileSizeX * 2.
Now after youāve confirmed that the item clicked is adjacent to the active unit, you can activate a custom event or function in either your item or your unit or inventory manager for adding the item to the unitās inventory. There are many ways to do this, of course. Personally I might have added an event (perhaps an interface event) to the item, which includes an input for the unit picking up the item. Then for this event you could choose to play whatever animation or sound you want for picking the item up and then add it to an item array stored on the unit (or whatever method you are using for storing the item).
Sorry if my explanation is a bit vague, but since Iām not exactly sure how your inventory system works I have to be a bit general in my response. Let me know if what I said makes sense to you or not.
Hi junghoon. Iām not sure I understand exactly what you mean by ātreated like an obstacleā. Enemy units are by default treated at least somewhat like and obstacle, in that you cannot move through them. Please go into more detail and I will do my best to help.
Great! No, it was pretty easy to fix when I knew what the problem was. I had just set up some stuff wrong in the grid manager, and I just had to connect it correctly. Thanks for reporting the bug. I have now sent Epic a hotfix which includes fixes to all the issues reported in the last few days, as well as a few more Iāve found on my own.
You can use the GetDistanceInTilesBetweenIndexes function (again, not sure if I got the name exactly right) in BP_GridManager for this. Input the grid index of the attacker and target and use a branch to check if the return value is greater than one.