Checking if an Object is attached to a Socket.

Hey Everyone

As an example, I have an actor BP which is just a Table and I have created a Socket on that table so I can attach other actors to it.

Basically I want to spawn a Pickup Item on it, which I can do, however what I am not sure of, is once I have picked up the spawned item off the table, I basically want the Table Actor to know that there is no longer anything attached to the socket. Just not sure how to approach this.

I know that once I spawn an item on the table, I can set a bool inside the Table BP that says the Socket is in use. However, what would be the best way to go about telling the table the socket is now free again once I have picked up the item?

Just after a basic Idea of how to approach this.


Two possible approaches, have an event on the Table that the socket Actor can subscribe to, when you pick up the Actor trigger the event.
Or you can store a reference to the Table in the Actor, on pickup you can call a method on the Table reference which will clear the flag.

Thanks for the ideas. I will try and put them into action and see how I go.

EDIT: Ok, I was able to get it to work pretty much using your second method.

I actually store a reference to the table in the PickupItem BP as well as a Bool which determines if the item was spawned by the table.
So basically, once the item is spawned, it sets a Bool on the Table to say the Socket Has an Item On it, and also sets the Reference to the Table in the Pickup BP and sets the Bool to True for being spawned by the table also in the Pickup BP.
This way, when the player picks up the item, it checks to see if it was spawned by the table, then if so, I’m able to to get the table reference and set the bool in there to say the socket is no longer in use and also reset the bool that it was spawned by the table back to it’s default.

Works a treat. Thanks.