Object Contains node giving random errors?

Hey there,

I got a weird thing going on that works sometimes then doesn’t work other times. Maybe you have some insight?

What I’m trying to do is make a blueprint volume that tells the player if they can’t build in an area.

At Event_BeginPlay I’m getting all actors of class (Blocking Volume) and setting that to an array variable.

Then I use a contains node to check if a hit result contains any blocking volumes so I don’t spawn an actor there.

Sometimes the blueprint (shown below) works and compiles without issues, then sometimes I open up the editor and it’ll give me errors. Then it’ll go back to fixing itself. Other times it will let me hook up the pins, other times it won’t.

Sometimes, it says Object Ref not compatible with Actor Object Ref. But then times like right now, where I hooked it up in a specific order, it works just fine.

Any help or insight is much appreciated. Including better ways to achieve this.

Thank you,

-Metric

Hi Metric

Those errors aren’t random (but a part of you already knew that). Rather than tackling how to solve them, may I suggest a different approach?

You don’t need to maintain an array of any sort. You have blocking volumes, [they already belong to a particular class][1]. I will assume that they belong to the same class. Simply break the results and check if the Actor belongs to this class

. If you have multiple base classes, use [tags (documentation)][3]

It worked flawlessly! Thank you so much.