Destroying Actor hit by Sphere trace error

I’m doing an inventory system and I’m trying to make an event that destroys the object hit by a sphere trace when picking it up. The item is destroyd but I’m getting an error that I don’t understand:

Blueprint Runtime Error: “Attempted to access BPTestITem_C_UAID_E070EAA9EEAB85CB01_1617180935 via property CallFunc_InteractionTrace_LookedAtActor, but BPTestITem_C_UAID_E070EAA9EEAB85CB01_1617180935 is not valid (pending kill or garbage)”. Node: Destroy Actor Graph: EventGraph Function: Execute Ubergraph Inventory System Blueprint: InventorySystem

1 Like

It’s because this

is running every frame, regardless of whether there is a looked at actor or not.

It would make more sense to have the line trace happen when you used the interact event.

Also, the destroy is pulling an empty from the function if you click ‘interact’ when not looking at something.

1 Like

That doesn’t seem to be the case, because if I remove the interaction trace from the event tick and put it before the destroy actor node, I’m still getting the same error. Also, I need it to run every frame to display a text message of what I’m looking at, to tell the player that it can be interacted with.

Can you show me how you would solve it?

You could just put an ‘is valid’ on the before the destroy actor.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.