Hey Nachtmahr,
That’s really great advice, we had someone propose just that yesterday while we discussed this issue internally.
It would be very convenient to get all actors every time as it creates a very dynamic and decoupled system in which you can just slap an interface on to an actor and there you go you get full functionality without having to tie him in to a life cycle process that keeps track of existing actors of that interface.
You’d have to manage the life cycle of every interface you might be calling an “all actors” call upon.
I guess managing arrays of actors is doable and considering the performance cost it would probably be the best thing to do.
We’re probably going to manage arrays of actors by relevant interfaces.
If the cost of “get all actors with interface” was closer to that of “get all actors of class” I would probably go with it instead of the actor tracking design as it allows for much simpler maintenance and faster development.
Note that query time never changes when you get all actors of a specific class no matter the amount of other actors not belonging to that class are currently on the scene.
The engine doesn’t query every actor in the scene to get its class information, the time remains constant.
Just as the engine needn’t iterate over every actor in the scene to query its class it seems possible and logical to not have to iterate over every actor just to get its interface.
So I would appreciate if Epic would consider implementing the proposed “tracking of actors with a specific interface” logic in a more efficient and generic way into the engine (if not with interfaces than at least with tags).
Actors can’t change interfaces at runtime just as they can’t change classes, these interfaces are a static and fundamental property of that actor.