[BP] Ability to reference existing components in variables/arrays statically

Let’s say I created some components in blueprint object or UMG’s widget.
I can’t add it these components to array of components via Variables section. Or simply assign it to variable. Existing components aren’t listed variable’s asset picker.

I have to assign it to variable/array by using Set node at Begin Play, Construction Script in actors or Construct, Pre Construct in UMG.
It’s quite cumbersome… It would be awesome to improve it :slight_smile:

Just to be on the same page - you don’t see these components under the “Component” category just above the “Variables” category on the left side? They are not listed as variables because they aren’t technically variables.

I see it, of course :slight_smile:
But if I’d like to iterate on many elements at once, it’s lot easier to store selected elements in array. It’s a mess if you need to reference group of components in many places. Especially if you constantly change your UI or complex actor.
Or sometimes I need to assign different components to dynamic variable during a game.

Currently we can’t assign components to variables “directly” - by using asset picker on variable. We have to do it in runtime. That’s it.

Can you explain the concept of, hmmm, basically everything you said, I do not understand what you doing right now and what you want to be done so you can do it better?

OK, I’ll use UMG example :slight_smile:
And I maybe after explaining someone points me there’s actually a way to do it engine already :wink:

  1. Create many components like Text Widget and mark every component as variable.
  2. Now, when you want to do something with 10 components at once, you could get its parent, iterate on every child, right? But often you don’t want to iterate on every child. Or you want to do something to many children of different parents. So you need to drag every single component to graph (you can’t select multiple elements in Variables section).
  3. You would need to do it every time you need this set of variables… (look at the photo #1). It’s a mess - especially if you’re constantly changing this UMG. That’s why I use “workaround”, grouping all variables (photo #2). And then I can easily operate on entire group without placing Text Widgets directly to the graph, every annoying time. (photo #3).
  4. What I’d like to have is to assign these Text Widgets to array without any coding in graph, just by using asset picker. And it’s not possible, asset picker in UMG/Actor doesn’t list widgets/componets (photo #4).

I understand this change could be not that trivial at it seems. And it would be great to have it both for UMG and Actor (could be two different tasks).
But it’s something I’m missing while working with complex UMG/Actors.

I personally would not make an array member just to hold so I can iterate, its such a waste, so I don’t see any use of it, but I cant see why not have asset picker.

If you create them statically then you can connect them manually into a MakeArray, ones in ConstructionScript would be simplest. Or just get all components by class and save into array. But nothing stops you from making them dynamically by using add component and imideately adding reference to array. I’m not really sure if editor should be a solving problem of creating many static objects, in c++ it would be even worse than in BP and will take more time, unless you macro it.