When attempting to destroy actor the actor is returning as 'not valid' 80% of the time?

Hi all! I’ve got a curious bug happening when destroying my enemy character. The blueprint says that when the enemy is overlapping the players hitbox and the player is attacking, it destroys the enemy overlapping the players hitbox. Problem is when this is happening it keeps returning none in the errors and is only destroying the enemy 20% of the time. I have added an is valid node connected to the enemy object before destroying the actor, and when testing it keeps showing that the object is not valid most of the time. I’m very confused about what I could do to fix this and would appreciate any help :slight_smile:.



• The destroy node should be connected to the execution chain that starts with the begin overlap node, not your custom event. To check if the attack is triggered when an overlap occurs, you can either turn a bool type variable’s value to true when your event is triggered and check that condition after the overlap, or place a gate node after the overlap node and open it with your event.
• The reason it not always does what you expect is because currently it’s conditioned to a random bool value

Thanks for the response Vis, whilst I appreciate your response i’m not quite understanding it. Could you please send a screenshot example of what you mean?

Here :innocent:

You can alternatively use a Gate node. And like I said, the reason it sometimes doesn’t destroy is because you’ve conditioned it to a random bool.

Thanks for the response, just a few questions though. The ‘Is Attacking?’ bool is set by a separate event where the player is pressing the LMB, and I have those 2 branches there to check whether 1. The player is attacking 2. The enemy is overlapping the player hitbox before the enemy can be destroyed. Do all of these not need to be involved for the blueprint to work? The random bool with weight is deciding whether to randomly spawn a health pickup where the enemy is being destroyed but ALWAYS destroys the actor nevertheless and why would I not cast to the basic enemy as the other actor involved in the overlap event, as that is the actor that needs to be destroyed in this case?

I thought that was the objective. Why did you get confused when it wasn’t being destroyed every time if that’s not the case? :thinking:

You can still implement it the way you want though. Just store the random bool result inside a variable (set it after your custom event) and use that variable to determine whether the enemy should be destroyed or not (place this logic after the begin overlap node where the destroy node is, like I’ve shown)


The Cast To node would be obsolete in this case, since we’re feeding the actor into the node’s input pin and taking it out of it’s output pin.

Sorry if I wasn’t clear that is the objective, its just not working currently

I think there’s a confusion going on. Would you mind showing your current setup and explaining the outcome you want?

If there’s a communication wise issue going on, you can share your Discord with me via private messages on this platform and we might be able to come to an understanding sooner.

Not trying to be thick but I can’t figure out how to send a private message to you :sob: Do you mind messaging me and explaining where to find where you’ve messaged me?


You didn’t check if the enemy is not valid when is going the bottom route. I bet that the branch 80% is false this is why it tells you that is invalid. Because probably when he go to the destroy from the bottom is already destroyed or is invalid.
Also if the event attached to the cast didn’t fire the actor will always result invalid and if fed from the false branch it also will result invalid

Solved! Problem is that the cast is being triggered on the overlap event so therefore the overlapped enemy is returning as ‘none’ when attacking. Fix is to promote the Basic Enemy to a variable and set that variable every time the overlap event is triggered, and then get the variable for when it is required in the attack event. Thank you so so much to @VisAgilis for the help it is really appreciated!

(This method also works with the destroy node BUT I have edited that so that it now deletes all of the enemy actors within the hitbox, also thanks to @VisAgilis) :smile:

1 Like

It doesn’t make much sense to set something to what it already is over and over, so you can either do it once either after the first overlap or on begin play.

Happy to help :innocent: