Runtime error


I am getting an error in the branch node. The returned value of the is overlapping actor node is empty, but the blueprint is working well regardless to the runtime error.
Is there a problem if I did not solve this error? if yes how can I solve it?

Thank you,

The reference from Get All Actors Of Class node is probably not valid and that is why you are getting the error, you can check if it is valid with Is Valid node.

Let’s say you have 10 Sedans, by using Length and iterating through an array like this you are trying to access the 11th element that does not exist.

Try one of these instead:

I’m still getting the same error.

for the sedan class actually I have a generator that generates cars from the beginning of the landscape and then when these cars arrives at the end of the landscape I destroy them. Do you think the generator can be the problem as the array size is changing!

Difficult to say what is causing this without seeing the rest of the code, especially if you run this on Tick and keep changing the size of the array. Have a look at what [MENTION=29846]Blue man[/MENTION] suggested above - drag a wire off Get and do IsValid - this will allow you to skip invalid references.

I tried to do IsVlalid and it always return invalid. So I have decided to not check the type of the car. Is there a way to check if there is an overlap with any movable or AI actor ?

Instead of doing Get all Actors of class and doing Is Overlapping, do

Get All Overlapping Actors

And cast them to the sedan

If there’s a successful cast, set IsOverlapping to true.

I did what you suggested, but I am still getting the same error the overlapping actors are empty sometimes so I am getting the error from the for loop.

I think the main problem is having a generator for the cars.

Any suggestions?