# Right click inv item

**URL:** <https://forums.unrealengine.com/t/right-click-inv-item/479858>\
**Category:** Character & Animation\
**Tags:** right-click, unreal-engine, question\
**Created:** [March 6, 2021, 11:40pm UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858 "2021-03-06T23:40:10Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![anonymous\_user\_da8b3399](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_da8b3399](https://forums.unrealengine.com/u/anonymous_user_da8b3399)\
**Post date:** [March 10, 2021, 4:35pm UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858/21 "2021-03-10T16:35:49Z")

</div>

i find it hard to follow certain tutorials becose after a while and after everything going fine for a wile the youtuber starts making something that dont make sense to me and i belive there is a better way but im too dumb to even comment about it, for example few days ago i was cheking nice border type inventory with slots and everything was fine untill the guy uses 3 types of blueprints just to open and close inventory 0.o, and i thought: w8 in my 1st inventory to open and close is just a simple bluepring that brings the widget to viewport, set control to widget and show mouse cursor, and then to close it its just the inverted function very simple, but the guy was using function to toggle and overrides, and im like confused becose, yea ok my inventory sucks becose made of click but at least is stupidly easy and fast to make it open and close

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_da8b3399](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_da8b3399](https://forums.unrealengine.com/u/anonymous_user_da8b3399)\
**Post date:** [March 10, 2021, 4:51pm UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858/22 "2021-03-10T16:51:21Z")

</div>

and the main thing is ive allready finish my inventory and works fine i pick up item that have interactable area, even highlight item showing that i can pick it up, it goes to inventory i can equip and everything database tecnacly done but i wanted so that my buttons would have more option than just stupid left click, but i didnt wanna lose everything that i made until now, i just wanna change my slots from buttons to borders so that i would have more functionality like the right click like i mention, i thought it would be easy just to remove the crappy button and use difrent type instead but when i do that, the items i pick up dont show up anymore, so the question is, how would i change my inventory in order to use border but still keep it connected to everything i have

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 10, 2021, 4:52pm UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858/23 "2021-03-10T16:52:53Z")

</div>

> my 1st inventory to open and close is  
> just a simple bluepring that brings  
> the widget to viewport, set control to  
> widget and show mouse cursor, and then  
> to close it its just the inverted  
> function very simple

Generally speaking, simplicity wins. But there are some behaviours that cannot be an on / off toggle.

- you press ‘I’ in the player controller to open the inventory
- set input mode to UI only so the player cannot move around
- press ‘I’ in the player controller to close the inventory but…

…it no longer works; none of the keys work because we’re in the _UI only_ mode. So now you must handle ‘I’ in the widget. Which is another brand new overridden function.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 10, 2021, 4:57pm UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858/24 "2021-03-10T16:57:31Z")

</div>

Can’t answer that as I don’t know how it’s built. If you want an image to show the icon:

![332019-screenshot-6.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/c/9/7c9fa3033d1d6ee65da02bd32877ae947312b534.jpeg)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 10, 2021, 5:00pm UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858/25 "2021-03-10T17:00:14Z")

</div>

> how would i change my inventory in  
> order to use border but still keep it  
> connected to everything i have

Technically, you could make the button _Hit-Test Invisible_ so it can’t be clicked and place a transparent (but _Visible_) border on top. This way the button serves as a glorified image only which defeats the goal of having a button in the first place.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_da8b3399](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_da8b3399](https://forums.unrealengine.com/u/anonymous_user_da8b3399)\
**Post date:** [March 10, 2021, 5:01pm UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858/26 "2021-03-10T17:01:15Z")

</div>

look at how simple my inventory and equipme

 ![332024-screenshot-9.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/7/5/b75712c9f04ffa6bc01547601b079a11cfa8acf7.png)

nt window are, and they work perfectly fine

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 10, 2021, 5:04pm UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858/27 "2021-03-10T17:04:59Z")

</div>

Regarding right clicking buttons, here are some hacks:

> **[\[UMG\] Right Mouse click on a button](https://forums.unrealengine.com/questions/139391/umg-right-mouse-click-on-a-button.html)**
>
> Is there any way to fire OnClicked event, when I press RMB on a UMG Button? Right now it fires only when i press Left mouse button, so i have to compare cursor position with button pos&scale in Character. Its not the best way to make, but I...

And here’s why you shouldn’t do it:

[https://forums.unrealengine.com/development-discussion/engine-source-github/42402-are-there-some-ways-to-handle-right-mouse-click-in-umg-button?p=431577#post431577](https://forums.unrealengine.com/development-discussion/engine-source-github/42402-are-there-some-ways-to-handle-right-mouse-click-in-umg-button?p=431577#post431577)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 10, 2021, 5:11pm UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858/28 "2021-03-10T17:11:11Z")

</div>

It’s not great, sorry. Why not create the inventory _once_ and then show / hide.

_You create a brand new widget every time it opens?_

Why? What happens to the items inside? You rebuild it all every time it opens? Sounds completely unnecessary and seems to be a waste of resources.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_da8b3399](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_da8b3399](https://forums.unrealengine.com/u/anonymous_user_da8b3399)\
**Post date:** [March 10, 2021, 5:53pm UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858/29 "2021-03-10T17:53:25Z")

</div>

thats the thing besides these 2 i have also bouth of them beying created when you start the game, so even for example is i equip an item without ever opening the equipment window, he will actualy be equiped and stay there when i open it, so nothing gets lost i run into the problem that item whare going to oblivion but i manage to fix it, but it no matter i just deleted everything equipment and inv, i might as well start from scratch

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 10, 2021, 6:18pm UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858/30 "2021-03-10T18:18:17Z")

</div>

Sounds very similar to [this issue][1]. The idea is to create the widget _only once_ and then show / hide it; image from that thread:

 ![331488-02-showhide.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/5/f/d5f0271f63a1ba65e00993b76144819a570e5db6.jpeg)

- the items can be added straight away
- no need to rejiggle / rebuild widget geometry (which can be _very slow_ with large amount of complex children and prone to text layout issues, below)
- it can be updated and force _ticked_ (Force Layout Prepass) when the player cannot see it - helps with text layout
- it’s much more efficient and easier to show / hide an element rather than remove / add in viewport

Regarding the last bullet point, eventually you may want to create a layered inventory with canvases that can manipulate Z order within their own layer. But this may be irrelevant here, depends on the scope.

* * *

Start small, don’t worry about pretty icons, work with placeholders.

Look into how [interfaces][3] work - these are _crucial_ when it comes to simplifying communication and interactions between world objects and their representation in inventories. And _Event Dispatchers_ work great for actor \<-\> owned widget data exchange.

Here’s a primer on interfaces I posted a couple of weeks ago (the long non-green answer):

> **[Why does this gate not work?](https://forums.unrealengine.com/questions/1013265/why-does-this-gate-not-work.html)**
>
> Hello! I’m currently trying to do a line trace for objects, allowing them to picked up. The branch’s true or false nodes work by themselves, The E keyboard event works, but when put through a gate it doesnt work. Any idea why?

The project is attached somewhere at the bottom. It’s _not_ about an inventory per se, but that’s like a building block of a system. Not a tutorial but more of a demo of an approach.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_da8b3399](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_da8b3399](https://forums.unrealengine.com/u/anonymous_user_da8b3399)\
**Post date:** [March 10, 2021, 7:20pm UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858/31 "2021-03-10T19:20:21Z")

</div>

dont worrie i dont even bother with icons or beauty at this stage the plan is to make a working game with all the basics/hard part done, after that it comes the fun/decorating/story/maps/icons animations etc… i wanted to make it like this becose I HAVE A DREAM, AND THAT DREAM IS… TO HAVE A DREAM 0.O no jk i just wanted to make a basic game that i could have fun and maybe one day go bigger and make ppl have fun, a game that would have a little bit of everything, combat, leveling, race, board games inside a game, casinos maybe, events and many other things, but everytime i see someone making a game it anoys me a little becose some ppl only care about landscapes and scenarios and using animations from websites like mixamo or characters and they dont make the hard part of the game so the relsult is, they abandon the game after a while. So i wanna focus on the hardest parts 1st like the blueprints of mechanics, then and only then ill start with the less hard part

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_da8b3399](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_da8b3399](https://forums.unrealengine.com/u/anonymous_user_da8b3399)\
**Post date:** [March 12, 2021, 6:50am UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858/32 "2021-03-12T06:50:53Z")

</div>

■■■■ you really need to make some tutorials on youtube that would get you 1 sub, me XD

---

<div class="post-metadata">

**Author:** ![BWhiterose](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BWhiterose](https://forums.unrealengine.com/u/BWhiterose)\
**Post date:** [January 4, 2024, 9:03pm UTC](https://forums.unrealengine.com/t/right-click-inv-item/479858/33 "2024-01-04T21:03:57Z")

</div>

I think I know the specific tutorial he got this from, and I was actually thinking this exact thought when he did it.

> [@anonymous\_user\_da8b3399](#):
>
> ![332024-screenshot-9.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/7/5/b75712c9f04ffa6bc01547601b079a11cfa8acf7.png)
> 
> 332024-screenshot-9.png1600×900 342 KB

anon you are also doing the same function twice here. You can simplify it by pulling the differing variables in question to the begin node. Then just call it and plug the differing variables in on call.

[Previous page](https://forums.unrealengine.com/t/right-click-inv-item/479858.md?page=1)
