I’m trying to make a black hole gun where objects get sucked into a void but looping through the array takes to long so the effect is sluggish, the closest object gets chosen WAY too slow so the dynamic effect takes an eternity and ruins the point. Thanks.
Why would you even need to find the closest object? Just add a trigger volume to your black hole BP and apply the black hole effect to anything in that trigger area.
If this is taking a long time, I assume you’re checking against a large list. If this is the case, you could just use a primitive component(that does not block, and checks against appropriate channels). Once you have this component you can either do what Alex8546 suggested, and apply the effect to all objects that overlap it, or if that’s not what you want, use the primitive component’s “Get Overlapping Actors” node to access the(probably) much smaller list of actors, and do your usual check there.
It seems to me that if you’re getting slow downs with something like this, you either have an insane amount of actors to check, or you’re doing something wrong algorithmically. It may be worth posting your solution here so we can check if it’s reasonable.