Seeking Clarity on how Actor Reference Variables work

I’ve been using Unreal for about 2 years now and feel comfortable with it but one thing I still haven’t modeled in my head very well is how Actor Reference Variables work and can’t seem to find documentation that really outlines this. When communicating across blueprints I always use Castings and when I can’t (or don’t know how to) cast I use Get All Actors of Class. Using these two methods I get by but there are places where I am using Get All Actors of Class on the event tick and it would be perfect if I could store the actor bp I want in a variable and just pull it’s data from that.

My Question: How the hell is this done? I know how to do it in terms of static blueprints that just sit in the level (like trigger boxes and static objects in level). But what about for dynamic Blueprints that come in and out of the game (like player controlled pawns, guns, bombs, Cameras that come in under specific circumstances etc.)?

-Selecting the specific actor reference in the variable selection drop down doesn’t appear to have any effect (I get no data or accessed none).

-Setting the variable with an all actors of class on event begin play gives me no effect or accessed none

Do these variables have to be set in a specific place (like gamestate or something)?. Do you have to set these variables in specific ways (like interacting with the BP first in game)? Is using variables in this way just not a thing? I feel like im missing something trivial here, any clarity is appreciated.

Thanks

If you set variables using all actors of class on begin play you have to add a delay because otherwise the script runs before the actual actors are spawned. Running it on tick is very wasteful and it’s better if you replace it either with begin play with a delay (very small value) or DoOnce in the tick should work too.

You can also try using other means of blueprint communication like event dispatchers, that way you only have to get a reference to the player instead which should be easier (get player controller - get controlled pawn or something).

Use events and interface functions always; never look for direct references of actors unless for very specific things where the reference almost never changes.
Directly referencing everything is bad design and brings a lot of problems the more the project grows.

But what about in the case of two separate actor BP’s that need to communicate per tick (like a Find Look At Rotation in Character BP for a camera that is always looking at a Ball Actor bouncing around in the map for example). I am doing this now by using a Get All Actors of Class on event tick to get the world location of the ball in character BP, then calculating that with Character BP location vector to get a constant look at rotation. Even if I store a world location vector variable in the Ball Actor I still have to pull it from the Character BP per tick somehow don’t I? I have no specific “Object Slot” for the casting to the Ball Actor and if not using a variable then Get All Actors of Class seems to be only option. I feel like there is a better way. That being said I don’t really notice a frame rate drop using Get All Actors of Class on tick but I often see warning signs against it.

Ah the infamous mild delay before Begin Play. Yeah forgot about that. Thanks for the suggestions.

If you store a BP reference as a variable you don’t have to use Get All Actors of Class on tick, Get World Location or whatever will still update every tick if you calculate it on tick.

Ok I haven’t dug into this since I posted but the whole problem is I can’t get data at all from bp references. once I actually have a functioning variable then yeah I can do the location but it’s the setting in the first place that I’m asking about. Perhaps all I need is the short delay to get all accessed to variable set on begin play.