Attempted to access BP, but BP is pending kill

Just getting started with Unreal and finding that when my Pawn collides with the wall at a reasonable speed it is creating an error "Blueprint Runtime Error: “Attempted to access BP_Ship_11 via property Spaceship, but BP_Ship_11 is pending kill”.

So I disabled Actor: Can be damaged. This doesn’t help. I haven’t added any concept for health and am not sure where to go from here. Super new to Unreal, any ideas?

When the actor gets destroyed, it does not really get destroyed immediately. It’s added to a pending kill list and will be scooped up soon and memory freed. This also means it not accessible during this time.

What is most likely happening is that you destroy the actor and then try to access it. Is Destroy called anywhere on the Ship.

Not strange yet. It’s a pretty classic access violation error. You can click the underlined parts and it will take you to the culprit - the user interface tries to access an actor that is apparently being destroyed.

Can be damaged has nothing to do with it - it’s just a flag for some event dispatchers. Although I can easily see them being associated with handling Destroy.

You can also do Search (ctrl + f), search for Destroy and hit the binoculars icon to search in all blueprints - this will spit out a list which you can step through by double clicking on the items.

Are you using one of the templates?

CTRL+F found a few hits for ‘Destroy’ though none that seem to apply (lightStudio, RendertoTexture, and Tutorial Assets Blueprints). Searching for ‘kill’ found more blueprints, some relating to velocity, although I wasn’t able to get the event to stop happening.

Using the Third Person template which has a bunch of work in it that I don’t need, so I loaded my blueprint into a blank template and there is no issue with collisions now. Lesson learned.

Thank you for teaching me more about Unreal.

I haven’t added much at all to the blueprint aside from simple navigation, a camera toggle and a light switch. There may be some other functionality for damage/destroy that I am not aware of. I figured unchecking actor:can be damaged would get around the issue.

Strange huh?