[Crash] Why does spawning an object based on the destruction of another object cause a crash?

I get a 100% reproducible crash from the following blueprint:

I can’t figure out why this is happening. When i spawn one object, I bind that instances OnDestroy event to the class that spawned it. When that OnDestroy event is called, I want to repeat the process of spawning a new object. This doesn’t seem to be an infinite loop, and there is always an object present that can provide the source for the bind. any thoughts on why this is crashing or an alternative logic to produce the same effect?

#Event Destroyed

Instead of your custom event setup why dont you just work off of the built in event Destroyed ?

Then add just the node for the part of spawning a new spider

You shouldn’t be calling Set there because the actor is about to be destroyed, settings it values wont mean anything

Set the Occupied var in the Begin Play event for the spider.

#Final BP Graph

Event Destroyed → Spawn

2 nodes total

Let us know if that works!

Rama

I tried this version if I understood the response correctly. It compiled fine, but the crash still occurs.

Basically I’m just trying to have a spawn point actor blueprint spawn an actor, then when that actor is destroyed, the spawn point blueprint that created it is notified so the spawn point can create another one.

Ok, solved the problem. The graph was good to go. The AI that was spawned was causing the crash. Not sure why the first one worked ok, and subsequent spawns failed, but managed to fix the issue with the following graph:

some supplemental info here for anyone else that may come across this: the AI has a ‘wander’ sequence. that sequence was being called from two points - the beginplay wihtin the AI blueprint and a direct call to the custom event ‘wander’ also within the AI blueprint. when i removed the ‘beginplay’ as an event trigger, and forced the call to ‘wander’ in order to start the AI brain, things seemed to work fine.