# How disgusting is this reference ?

**URL:** <https://forums.unrealengine.com/t/how-disgusting-is-this-reference/1982735>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [August 19, 2024, 10:58am UTC](https://forums.unrealengine.com/t/how-disgusting-is-this-reference/1982735 "2024-08-19T10:58:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AdamGaming\_CZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AdamGaming\_CZ](https://forums.unrealengine.com/u/AdamGaming_CZ)\
**Post date:** [August 19, 2024, 10:58am UTC](https://forums.unrealengine.com/t/how-disgusting-is-this-reference/1982735/1 "2024-08-19T10:58:20Z")

</div>

I am referencing inventory from its child object, what do you think about this solution?  
Not sure if its illegal or absolutely flawless solution.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/0/c/a0c8bf55e7abd521972115d2e7a84ba3b194cb3b.png)  
Share you opinions please 🙂

---

<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:** [August 19, 2024, 11:15am UTC](https://forums.unrealengine.com/t/how-disgusting-is-this-reference/1982735/2 "2024-08-19T11:15:12Z")

</div>

> **It's pretty**
>
> disgusting

* * *

Out of sheer curiosity, who needs to talk to whom? Where are those actors? Inventories are generally aware of their own children whereabouts, so a child would talk to the inventory through an Event Dispatcher.

---

<div class="post-metadata">

**Author:** ![AdamGaming\_CZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AdamGaming\_CZ](https://forums.unrealengine.com/u/AdamGaming_CZ)\
**Post date:** [August 19, 2024, 2:18pm UTC](https://forums.unrealengine.com/t/how-disgusting-is-this-reference/1982735/3 "2024-08-19T14:18:01Z")

</div>

Actually to lazy to write it down so there is it drawn 🙂

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/5/3/c533cf079f9a40a007e9f0e40dfd68ca000508b0.png)  
something like that.  
But i had to do it this way because i have equip button in entry becasue i have to signal by bpi to inventory that item is equiped.  
Idk it worked this way

---

<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:** [August 19, 2024, 2:24pm UTC](https://forums.unrealengine.com/t/how-disgusting-is-this-reference/1982735/4 "2024-08-19T14:24:36Z")

</div>

> [@AdamGaming\_CZ](#):
>
> Share you opinions please […]i have equip button in entry becasue i have to signal by bpi to inventory that item is equiped.

It does sound like a clear cut job an Event Dispatcher. The tile view spits out a widget ref every time an entry is generated, bind what’s need to the inventory’s custom event / function on the fly. Clean script, no more references and if something becomes invalid, no one will complain because Dispatchers couldn’t care less. And since tile view _automagically_ maintains widget lifecycle, there’s no need to unbind. 🤷

Good luck one way or another!

---

<div class="post-metadata">

**Author:** ![AdamGaming\_CZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AdamGaming\_CZ](https://forums.unrealengine.com/u/AdamGaming_CZ)\
**Post date:** [August 31, 2024, 9:48am UTC](https://forums.unrealengine.com/t/how-disgusting-is-this-reference/1982735/5 "2024-08-31T09:48:59Z")

</div>

But even for the dispatcher, I need the reference to the inventory where the dispatcher is declared, or am I completely wrong?

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [September 1, 2024, 3:50am UTC](https://forums.unrealengine.com/t/how-disgusting-is-this-reference/1982735/6 "2024-09-01T03:50:41Z")

</div>

there should be some common object you can get this information from, say for instance in your case if your inventory is a widget save a referance to it in the hud and then anything can access it by GetHUD-\>GetMyInventory

or if the inventory is one an Actor find a way to get that Actor and get its inventory component.  
If its single player you could basically store references anywhere, GameMode, GameInstance etc for easy access
