SLOW get all actors / with tag DO NOT USE EVERY FRAME ?!

hey

while i do not have an issue at the moment ,
i wonder if the “get all actors /of class/ with tag” DO NOT CALL EVERY FRAME situation is as drastic as it seems from the “on node” warning or i.e.:
-more modern computers simply handle this well now
-it`s not so bad via C++
-did i miss an alternative way to access such class references

im a casual user and i think i did once create a very slow BP flow that relates to this

tnx , have a good time

Unless you have the entier united states worth of surface area as a dedicated CPU the warning is very much still relevant.

You are asking the engine to query all actors for something.

First of, doing so every frame is silly.

Second of:
You are bottlenecking the usually desired frame time of .12 ms with less than 1000 actors to be checked just by computational execution speed of a comparison in c++

Sure, better CPUs with more surface areas will suffer less and less (hence a us wide surface arra cpu wont have an issue) but as CPUs increases and games get better, more actors get loaded, compounding your problem or keeping it just about the same.

And finally, the real question is Why.

What could possibly require to check all actors every frame?
If anything does, I can 100% guarantee the system and logic behind it are so poorly designed/thought out that even with the mentioned above CPU power you’d get issues with the project…

2 Likes

Adding up on what @MostHost_LA already clarified, here two more elements for you to consider.

Get All Actors of Class is a node meant to be used in the Begin Play to feed dedicated arrays (like spawn points and the like).

You are not supposed to use that node for actors spawned at runtime. What one does for tracking collections of runtime-spawned actors is implement a Pub-Sub logic so that there is always up-to-date knowledge of all classes created during the game as needed.

BTW, if also the level-defined objects register themselves using the Pub-Sub pattern, one doesn’t need to call that node at all :wink:

3 Likes

i should have typed “of class”

thank you for your input

ok tnx

May be a bit Better, but it’s still looping all actors and checking for something.

When you have 10 acotors it isn’t an issue, once you populate a level and have billions to look through you just get bottlenecked on the CPU…

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