Is Valid and errors

I have this simple and obvious check:


I tried to remake it in several different ways, but still keep getting errors that component is not valid right after this check. How can this be, what am I missing?

Very strange. Is the capsule component done in blueprints or is it done in c++?

If it’s c++ then make sure it has a UPROPERTY macro above it.

You could try pushing the is valid check after the sequence to do a check right before accessing it (but a 1 instruction set wait seems normal & this shouldn’t be mandatory)

It is done in BP.
I tried to simplify this nodes to the maximum. Still no good, same errors on the second “Set Response”

Try right clicking the Capsule component and choose “Find references” (you can then use the binocular icon in the search field to find it in all of the project)

Check if it is being destroyed anywhere in the project.

Just checked and it’s not destroyed anywhere (only the whole actor obviously). And I’m sure it’s not about the capsule as recently I had same errors about static mesh and BP itself. But was able to remake nodes so not to access their properties.
I changed the order of this two nodes and it seems to run fine for now. But I’ve a feeling that I’m not solving the problem but just sweeping it under the carpet.

Depending on the other settings of the actors/components the engine may update the overlaps immediately when you call SetCollisionResponseToChannel with a NewResponse that’s different from the previous setting. This may include calling events which could result in the actor being destroyed.

You should be able to deactivate overlap updates temporarily until after you changed the collision responses as necessary. Turning them back on afterwards should then perform the overlap update (which may still result in the actor being destroyed). Or you could just add another is valid check.

Do you have any collision/overlap events implemented anywhere? Especially that destroy actors/components?

1 Like

Thanks, that seems to be the issue.

Could you advise a node please?

Yes, of course. This actors spawn off screen with collisions set to “ignore” (so that player can’t hit them). After they enter the screen collisions are set back to normal in this nodes and some of the actors are killed+destroyed right after that. But the destruction is not instantaneous - there are some FX spawn and sound play etc. So I thought there was plenty of time to check validity in this nodes.

I’m not entirely certain about “Set Generate Overlap Events” but the “Set Collision Enabled” should help. Disable collision first (or have it disabled in the component defaults), then update the responses and finally re-enable collision with the previous setting.
image

Yep, that did the trick. I tried to return the previous order of my two nodes (so that the errors could appear again) and added this disable/enable nodes. No errors now. Thank you for the solution.

P.S. I didn’t try “Set Overlap Events” since my laser weapon is based not on overlapping but on blocking, so can’t confirm if this would help or not.

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