How to take control of an arbitrary actor from blueprint?

Hello all,

I’m trying to use a standard blueprint (not the level blueprint) to take control of a selected height fog in the level. I am aware that you need to cast to the actor, which is the obvious part-- the part I am struggling with is how to get it selected in the first place. How do you make it so that the user can select the fog (like, input its name) and then cast to it for the blueprint’s actions?

Thank you in advance for any advice on this, I could really use the help!

there are various ways to get a reference to a particular actor. i’ll list a few. you don’t necessarily use casting.

  1. using the “get all actors of class”/“get all actors with interface” returns an array, if only one actor of that class exists in the level then you can “get” the first element in the array which is the actor you want.(potentially expensive, don’t use on tick)
  2. you can create a variable of any actor class. so if you create a variable of type exponential height fog then make that variable public, you can manually assign the fog instance to the variable in the editor. (must compile bp to view public variable in editor)
  3. on collision/overlap events return actors as will a line trace.

also rather than having your level manager blueprint get a reference to various blueprints you can have the BPs get a reference to the manager and push themselves into variables. how you get the reference will vary depending on the context. pushing variables can make it difficult to know where the reference is coming from.

I guess I wasn’t clear the first time around. I was trying to basically make it so that you can take control of a skylight or fog and enter it into the public blueprint editor and change its parameters from there.

I found out that you can do it by creating a new fog or skylight variable and making it instance editable. This accomplished what I was looking for.

Thank you for your help on this however, it is appreciated.